Installing `libgd` from source on OS X

Using Matías Giovannini’s great instructions, I was (finally) able to get the GD library installed on OS X so I can build some charts in Perl. I’ve condensed his instructions into the shell commands that I actually needed to get everything installed, and record them here just in case I ever have to do it again. :)

1. Install zlib

curl -O
tar -xzvf ./zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --shared && make && sudo make install

2. Install libjpeg

curl -O
tar -xzvf ./
cd jpeg-6b
ln -s `which glibtool` ./libtool
./configure --enable-shared && make && sudo make install

3. Install libpng

curl -O
tar -xzvf ./libpng-1.2.16.tar.gz
cd libpng-1.2.16
./configure && make && sudo make install

4. Install freetype2

curl -O
tar -xzvf freetype-2.3.4.tar.gz
cd freetype-2.3.4
./configure && make && sudo make install

5. Install libgd

curl -O
tar -xvzf ./gd-2.0.34.tar.gz
cd gd-2.0.34
sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include
./configure && make && sudo make install

6. Celebrate!

I celebrated by installing GD::Graph via CPAN, you might prefer something more suitably exciting. :)