Sponsors

Apple Store

Visit the official Apple Store to buy a Mac online. Free shipping!



Editors' Picks


Comments

Contact Us

Search

Top Posts

Categories

Recent Posts

Our Feeds


Download files from the web via the OS X command line

Terminal Icon 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.

Curl in action

Digg!


Social bookmarks:


Comments:

Comments: 3

Comment from Dan Shockley
Time: May 12, 2007, 2:56 pm

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′

Comment from boomer
Time: May 14, 2007, 7:53 am

I have never used the curl command but this is pretty good

Comment from ToBeFrank
Time: May 28, 2007, 12:31 am

I use wget

Write a comment





May 11th, 2007