How to install GD on Mac OS X 10.4

This procedure is confirmed on several PowerPC and Intel Mac. Please feel free to add your knowledge.

  • Also succeeded on Intel Mac with Mac OS X 10.5.2 Leopard.

Install X11

from Mac OS X Install DVD

Install Xcode 2.3

from Mac OS X Install DVD or ADC
(easy install)
(2.4 will work well, but not confirmed)

Preperation

% set path = ( /usr/local/bin ${path} )
% setenv MACOSX_DEPLOYMENT_TARGET 10.4
% setenv DYLD_LIBRARY_PATH /usr/local/lib

Install zlib

% curl -O http://www.zlib.net/zlib-1.2.3.tar.gz
% tar zxvf zlib-1.2.3.tar.gz
% cd zlib-1.2.3; ./configure --shared && make && sudo make install
% cd ..

Install libjpeg

Mac OS X binary installer is available at http://ethan.tira-thompson.com/Mac%20OS%20X%20Port...

% export MACOSX_DEPLOYMENT_TARGET=10.4

(if these directories don't exist)

% sudo mkdir /usr/local/man/
% sudo mkdir /usr/local/man/man1/
% sudo mkdir /usr/local/bin/

Download libjpeg source from
(Obsolete - ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz)
http://www.ijg.org/files/jpegsrc.v7.tar.gz
% gnutar -xzf jpegsrc.v6b.tar.gz
% pushd jpeg-6b/
% ln -s `which glibtool` ./libtool
% ./configure --enable-shared
% make
% sudo make install
% popd
# configure will complain about ltconfig: "cannot guess host type; you must specify one." please ignore this.

Install libpng

Mac OS X binary installer is available at http://ethan.tira-thompson.com/Mac%20OS%20X%20Port...

lpng1212 doesn't work well on Intel 64bit machines.
% curl -O http://download.sourceforge.net/libpng/lpng1226.zip
% unzip lpng1226.zip
% pushd lpng1226/
% cp scripts/makefile.darwin makefile
Then change the 23rd line of makefile to;
 PNGVER=$(PNGMIN)

% make ZLIBINC="/usr/lib" ZLIBLIB="/usr/lib"
% sudo make install
% sudo ranlib /usr/local/lib/libpng.a
% popd

Install freetype2

% curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.bz2
% tar jxvf freetype-2.1.10.tar.bz2
% pushd freetype-2.1.10
% ./configure && make && sudo make install
% popd

Install GD

% curl -O http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
% gnutar -zxf gd-2.0.33.tar.gz
% pushd gd-2.0.33
% ln -s `which glibtool` ./libtool
% ./configure CPPFLAGS=-I/usr/X11R6/include/freetype2 \
 --prefix=/usr/local --mandir=/usr/local/man --bindir=/usr/local/bin \
 --with-freetype=/usr/X11R6 --includedir=/usr/local/include
% make
% sudo make install
% popd

REFERNCES

http://www.libgd.org/DOC_INSTALL_OSX
http://www.paginar.net/matias/articles/gd_x_howto....
http://www.toxodb.org/gbrowse/docs/pod/INSTALL.Mac...
http://www.kyngchaos.com/macosx/install/libgd.php
2009年11月20日(金) 05:28:27 Modified by kojima_ichiro