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

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

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.

This story, "cURLing for Wget" was originally published by JavaWorld.


Copyright © 2013 IDG Communications, Inc.