How to Build and Install GNU wget on Apple OS X 10.5 Leopard

Although OS X 10.5 comes with "curl", we prefer to use "wget" since it's more familiar. The following HelpFile will show you how to download, build, and install GNU wget for OS X 10.5 Leopard.

System Requirements

  • This HelpFile was tested for OS X 10.5
  • Apple's Xcode Developer Tools

Preperation

Using Safari or Firefox, download the latest source code from the GNU wget website (http://www.gnu.org/software/wget/). This link will always point you to the latest version: http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz. Extract the downloaded archive to a directory of your choice. For example, we will extract this to a folder on our desktop.

Once extracted, open up the terminal, and "cd" to the directory where you extracted your wget source code. Adjust the example below according to your setup.

cd /Users/admin/Desktop/wget-1.11.4/

Compiling and Installing

Before compiling, we must configure the source code for our system. This is as easy as running the configure script that is included with the source code. The configure script lets you specify options on how you want to build your program. For example, where you want it to get installed. By default, wget will install into /usr/local/bin. If you wish to change the install location, simply run the configure script with the "--prefix=/where/to/install" flag.

In the example below, I want to install all the wget files in it's own directory (/usr/local/wget). If you want to install wget into the default location (/usr/local/bin), just omit the "--prefix=/usr/local/wget" when running the command below.

./configure --prefix=/usr/local/wget

Once the configure script is done, type in "make" to start building the wget binaries. It will take about 10 seconds to a minute to compile wget depending on the speed of your system. Once the compilation is complete, install the binaries (as root) by typing in "sudo make install".

make
sudo make install

If you used the default installation path, to run wget just restart your terminal session and type in "wget". If you used an alternate location, you must use the full path to the binary, for example:

/usr/local/wget/bin/wget http://www.unibia.net
[/codefilter_code]

You can add wget to your ".profile" path, or system wide by editing "/etc/paths".

sudo nano /etc/paths

Just add "/usr/local/wget/bin" to the end of the file as shown. When done, press CTRL+X, answer "y" to save the changes, and press RETURN to update the file. Restart your terminal session to reload the paths.

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/wget/bin

Your Done!

It's safe to delete the source code directory and source code archive to keep your system nice and clean.