ImageMagick and RMagick on Leopard and other Large White Cats 6

Posted by markm Tue, 11 Aug 2009 18:47:00 GMT

Credits

This how-too is originally from Pastie254887. It is just updated. And of course there is the small part about ensure it works with Snow Leopard (OS X 10.6).

As far as I know this is the ONLY way to get rmagick running on Snow Leopard until people update their scripts.

Installing ImageMagick and RMagick

In theory there is an install script that will do this all for you. It doesn’t work on Snow Leopard. Below are the steps to follow to actually get it done.

#!/bin/bash
#
# Install rmagick without fink or macports
#
# Requirements: Mac OS X >= 10.5.4, XCode 3.1, X11

#Install freetype

curl -O http://mirror.csclub.uwaterloo.ca/nongnu/freetype/freetype-2.3.9.tar.gz
tar xvf freetype-2.3.9.tar.gz
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.v7.tar.gz
tar xfz jpegsrc.v7.tar.gz
cd jpeg-*
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 won't work)

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

#Finally: Install ImageMagick and set correct symlinks

curl -O curl -O 'http://image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.5.3-9.tar.gz'
tar xvf ImageMagick-6.5.3-9.tar.gz
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-perl --without-magick-plus-plus --with-quantum-depth=8 \
  --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

#And top it off with RMagick
sudo gem install rmagick