Download files from the web via the OS X command line
Command Line, Mac OS X, Tips & Tricks - May 11th, 2007 - 6 Comments
I am frequently developing web pages and often times I find it frustrating when I can not restart my browser because I’m in the middle of a download. So when I need to download a large file and I don’t want to have to worry about whether or not Safari or Firefox continues to run with out interruption, I turn to the trusty Terminal! Next time you have a file you want to download, option-click it and copy the URL into your clipboard. Now open a Terminal window and type:
cd ~/Desktop
Now that we have changed our directory to the “Desktop” we can start our download. For the download we are going to use a built in utility called “curl”.
curl -O http://www.bluechipx.com/downloads/BlueChip.sit
Read on for a screenshot of curl in action.




You might want to include a few extra bits in that post. First, always include the -L (or –location) switch, since that will allow curl to follow any redirects (if the file gets moved, but there is a redirect for it). Also, if the URL’s file part (the section after the last slash) is not pretty, you can give a name for the downloaded file by using a lower-case -o (instead of -O), followed by a space and the name in quotes. Also, always put the URL in single-quotes – ampersands and a few other characters will break on the command line if they aren’t in quotes. Here’s an example of those ideas combined:
curl -L -o ‘myfile.dmg’ ‘http://www.somewebsite.com/files/getdmg?id=24′
Thanks for adding that, Dan. That was the crucial tip I needed, especially the reminder about the quotes.
I have never used the curl command but this is pretty good
I use wget
nice, this really helped me tonight
I also use wget. you have to download it and compile it. or install it using fink or macports.