Apr 02 |
So when you need to download a large file and don’t want to have to worry about whether or not Safari or Firefox continues to run with out interruption, use Terminal and curl (wget replacement).
Note: wget is not exists in Leopard, you should set up an alias for wget to curl -O which does exactly the same thing:
echo 'alias wget="curl -O"' >> ~/.bash_profile
Your are done. Now just easy to use in Terminal. Here example to download iTunes.
wget http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-7203.20100330.XswP8/iTunes9.1.dmg
Curl is better than wget for the following reasons:
- Uses libcurl a cross platform library
- curl sends more stuff to stdout and reads more from stdin
- curl supports ftp, ftps, http, https, scp sftp, tftp, telnet, dict, ldap and ldaps while wget
- supports only http, https and ftp
- curl has ssl support
- libcurl supports more http authentication methods
- Curl is bidirectional while wget offers http post support only
- Curl has more development activities.
In fact, curl offers substantially better download statistics during
interactive use. It also has th excellent libCURL, which programs in the
operating system leverage as a transport layer. This is simply not
possible using wget, and writing an HTTP 1.1 client is pointless when a
really good one is already available.
Anything you can do with wget you can do with curl (with a little effort),
but no amount of effort will result in a well-factored libWGET. You can
(and I have) implemented recursive retrieval by passing the output of curl
through a sed script to find tags and download the target with more
curl invocations.




March 29th, 2011 at 5:59 PM
I’ll admit libcurl is better than any libwget, but curl on the command line is about as good (I think–and yes wget has ssl support). Regardless thanks for the tip worked a charm
April 6th, 2011 at 7:19 PM
I’ve done exactly what you stated, however when I now type
wget http://url.com
I get the following error:
-bash: wget: command not found
Then if I type “nano ~/.bash_profile” I can see the file alias you suggested which only contains:
alias wget=”curl -O”
What am I doing wrong? Should I delete the file and try and use “sudo” to make it again?
Also, if I try and simply use curl as the command it works fine.
curl -O http://www.mymacosx.com/files/2010/04/wget1.png
Thanks for your help.
April 6th, 2011 at 9:59 PM
Please just restart your computer or LOGOUT and LOGIN. must be help.
April 26th, 2011 at 8:18 AM
… no need to restart or logout… just start a new terminal. .bash_profile is loaded on your current terminal session, but not the newly edited one with your echo statement.
May 3rd, 2011 at 4:54 AM
Thanks for this tip on installing the wget alias on macs. Very usefule and easy to read.
May 20th, 2011 at 7:45 AM
Type “source .bash_profile” to have your changes load in the current terminal or logout and log back in like the others suggest.
June 1st, 2011 at 8:41 PM
“Anything you can do with wget you can do with curl (with a little effort).”
Any idea how to download a webpage when the URL is specified without a filename, and index.
doesn’t work? E.g., http://www.mymacosx.com/ .
curl can’t do this any way I’ve tried, it just hangs. wget works like a charm. Hopefully I’m just missing something about curl…
Thanks!
June 1st, 2011 at 8:46 PM
Ah, I’ve found a solution: http://download.cnet.com/Wget/3000-18506_4-128268.html
wget for Macs, trivial install
Maybe curl can do it, but wget makes it so easy…
June 1st, 2011 at 11:24 PM
@Segovia – you’re doing ‘curl -O’ (letter oh) and if read the output of ‘curl –help’ you need to be using ‘curl -0′ (zero)
July 17th, 2011 at 6:24 PM
Hello there
Somebody knows to execute binary files under command line.
When I put: ./hldsupdatetool.bin , I received: can not execute binary files
thanks.
July 25th, 2011 at 7:49 AM
awesome! thanks
July 25th, 2011 at 8:21 AM
gmopinillosv – you need to make it exicutble
chmod +x hldsupdatetool.bin
August 2nd, 2011 at 10:45 AM
wget may support fewer features, but it’s much easier to use. If you’re willing to write a sed script just to get recursive downloads, why aren’t you willing to download the source and build wget yourself?
August 4th, 2011 at 12:33 PM
“dyld: Library not loaded: /opt/local/lib/libiconv.2.dylib
Referenced from: /opt/local/bin/wget
Reason: Incompatible library version: wget requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
Trace/BPT trap”
what is that mean?
September 13th, 2011 at 12:50 PM
this curl suggestion is great for individual downloads — a common invocation of wget — but for recursive gets, wget is king. if you’ve written a script to handle recursion for curl, share it!
November 7th, 2011 at 8:53 AM
I have added -L to it, so it does not fail if a HTTP header has a “moved” response.
so curl -OL
Regards