Install and Configure wget on macOS

macOS Mojave, Sierra, and earlier versions come with the command line utility called ‘curl‘ which is a network transfer tool, it does not come with the popular ‘wget‘, in fact, ‘curl‘ can probably get you by just fine, check man curl at the command line to see its usage.

Otherwise, let’s look at getting ‘wget‘… this can be done in 2 ways.

1 –  Install from HomeBrew

brew install wget

2 – Compile from Source

To add and install wget to your system you need to download the source files, compile the code and make an install. To compile the code you need a compiler, unfortunately, it doesn’t come with macOS by default you need to install the free Xcode suite from Apple which includes the GCC compiler. This process also works exactly the same in previous macOS and OSX versions.

Get Xcode

Get the latest via Xcode via iTunes.

Xcode Yosemite

Next you need to install the Xcode command line tools, easiest way to do so by running in the Terminal:

xcode-select --install

Using curl to get wget

Get the latest wget source code from the ftp repository, or using curl from the command line:

cd ~/Downloads
curl -O https://ftp.gnu.org/gnu/wget/wget-1.19.5.tar.gz

Extract it and move into it

tar -zxvf wget-1.19.5.tar.gz
cd wget-1.19.5/

Configure and Install it

./configure

an error may occur on SSL…

configure: error: --with-ssl was given, but GNUTLS is not available.

wget needs to have some type of SSL support GNUTLS is most probably not available on your OS X system – if so use OpenSSL in the configure as an alternative use so re-run the configure with an SSL flag:

./configure --with-ssl=openssl
make
sudo make install

That’s it done, wget will be installed in:

/usr/local/bin/wget

Clean Up

Remove the source code and compressed file:

rm -rf ~/Downloads/wget*

Test wget

cd ~/Downloads
wget http://ftp.gnu.org/gnu/wget/wget-1.19.5.tar.gz

Everything should work out fine – if you need to install more Unix style tools it will be faster and better to install a Package Manager for OSX like Homebrew – it makes installing and maintaining these applications so easy,

Leave all Comment