Compiling ImageMagick for OSX

Refer to this http://pastie.org/254887

Install freetype

curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.3.7.tar.bz2
tar xfj freetype-2.*.tar.bz2
cd freetype-2.*
./configure --prefix=/usr/local
make
sudo make install
cd ..

Install ghostscript fonts

curl -L -O 'http://prdownloads.sourceforge.net/gs-fonts/ghostscript-fonts-std-8.11.tar.gz'
tar xfz ghostscript-fonts-std-8.*.tar.gz
sudo mkdir -p /usr/local/share/ghostscript/
sudo mv fonts/ /usr/local/share/ghostscript/fonts/

Install libjpeg (10.5 libjpeg won’t work)

curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xfz jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local/libjpeg
make
sudo mkdir -p /usr/local/libjpeg/include
sudo mkdir -p /usr/local/libjpeg/lib
sudo mkdir -p /usr/local/libjpeg/bin
sudo mkdir -p /usr/local/libjpeg/man/man1
sudo make install
cd ..

Install libpng (10.5 libpng would also work)

curl -L -O 'http://prdownloads.sourceforge.net/libpng/libpng-1.2.29.tar.bz2'
tar xfj libpng-1*.tar.bz2
cd libpng-1*
./configure --enable-shared --prefix=/usr/local/libpng
make
sudo make install
cd ..

Finally: Install ImageMagick and set correct symlinks

curl -O 'http://image_magick.veidrodis.com/image_magick/ImageMagick-6.4.2-9.tar.bz2'
tar xfj ImageMagick-6.*.tar.bz2
cd ImageMagick-6.*
export CPPFLAGS="-I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/include"
export LDFLAGS="-L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/lib -lpng"
./configure --prefix=/usr/local --with-modules \
  --without-magick-plus-plus --with-quantum-depth=16 \
  --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..
sudo ln -s /usr/local/lib/libMagickCore.la /usr/local/lib/libMagick.la
sudo ln -s /usr/local/lib/libMagickCore.dylib /usr/local/lib/libMagick.dylib