cURLing for Wget

Wget is an extremely handy utility I use all the time when I find myself on a Linux box. It’s quite helpful, for example, for downloading files. Need to install Ruby? No problem, just download the binary like so:

wget example of downloading Ruby binary
<span class='line-number'>1</span>
<code class='bash'><span class='line'>wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
</span></code>

and you’re one step closer. There’s no flags to remember either.

Wget, however, isn’t natively available on OSX. From time to time, I’m stung to see the nefarious ‘command not found’ message after expectantly waiting to see some file I need downloaded.

Luckily, you can force cURL to act like Wget with a few flags. Simply use the -OL flags like so:

cURL acting like Wget
<span class='line-number'>1</span>
<code class='bash'><span class='line'>curl -OL http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
</span></code>

and you’ll be on your way to downloading some file.

Of course, it’s possible to get wget on your Mac via MacPorts or Homebrew; nevertheless, knowing you can achieve the same goals with cURL is always handy.

Related:
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.