wget is great command line *nix program for grabbing things from the web, but it doesn’t ship with macs. It’s also not a part of the developer tools package. Here’s the steps I used to build and install wget on my mac.
Grab the wget source code from
http://ftp.gnu.org/pub/gnu/wget/wget-1.9.1.tar.gz (or get the latest
here) . Open a terminal window and follow along:
tar xzf wget-1.9.1.tar.gz
cd wget-1.9.1
./configure
make
sudo make install
The wget binary should now be in your
/usr/local/bin
folder. Let’s also put
/usr/local/bin
in the shell path so we can type
wget
from the command line rather than the tedious
/usr/local/bin/wget
when we want to run the program. This is accomplished by editing
~/.bash_profile
to add the following line:
PATH=$PATH:/usr/local/bin; export PATH
To get the shell to re-read this file again, type
source ~/.bash_profile
. Now whenever you start the terminal,
/usr/local/bin
will be in the path.
The other part of installing wget that needs a tweak is wget’s manual page isn’t found when running
man wget
from the terminal. To resolve this we need to edit the
man
configuration file.
sudo nano /usr/share/misc/man.conf
Scroll down a bit and below all the other lines beginning with
MANPATH
, add:
MANPATH /usr/local/man