Last updated

Installing RMagick Ruby Gem on Mac OS X 10.4.9

When you want to manipulate images with Ruby (or your Rails application) you’ll probably want RMagick installed. This is no easy feat on Mac OS X.

The official guide suggests installing X11 and using darwinports to install everything. This guide shows you how to easily install RMagick on you Mac OS X system. In this case I use Mac OS X 10.4.9.

Before you jump in, make sure you have Xcode installed. You can get it for free from Apple.

I’ll also assume you have Ruby and rubygems installed and working already.

You will need to download, compile and install several graphics libraries that RMagick needs. Let’s do this now.

 1curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz
 2tar xzvf freetype-2.1.10.tar.gz
 3cd freetype-2.1.10
 4./configure --prefix=/usr/local
 5make
 6sudo make install
 7cd ..
 8
 9curl -O http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.10.tar.bz2
10bzip2 -dc libpng-1.2.10.tar.bz2 | tar xv
11cd libpng-1.2.10
12./configure --prefix=/usr/local
13make
14sudo make install
15cd ..
16
17curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
18tar xzvf jpegsrc.v6b.tar.gz
19cd jpeg-6b
20ln -s `which glibtool` ./libtool
21export MACOSX_DEPLOYMENT_TARGET=10.4
22./configure --enable-shared --prefix=/usr/local
23make
24sudo make install
25cd ..
26
27curl -O ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
28tar xzvf tiff-3.8.2.tar.gz
29cd tiff-3.8.2
30./configure --prefix=/usr/local
31make
32sudo make install
33cd ..

Next we install ImageMagick:

1curl -O http://easynews.dl.sourceforge.net/sourceforge/imagemagick/ImageMagick-6.3.0-0.tar.gz
2tar xzvf ImageMagick-6.3.0-0.tar.gz
3cd ImageMagick-6.3.0
4./configure --prefix=/usr/local
5make
6sudo make install
7cd ..

And now, ladies and gentlemen, what you’ve all been waiting for: RMagick:

1sudo gem install --no-rdoc --no-ri RMagick

In my case the generation of the documentation fails, so I tell rubygems not to compile the docs.

You now have RMagick installed on you Mac OS X 10.4.9 machine! Congratulations!