Installing ImageMagick on OS X Leopard

So last night I tried to install ImageMagick on Leopard but couldn’t find the requisite blog article that detailed the installation. So I thought I’d write one. I managed to dig up some forum posts, so here’s the whole deal.

ImageMagick itself compiles fairly easily on OS X, but it’ll end up missing JPEG support, which was kind of a bummer. Here’s how to fix it without using MacPorts (which I avoid these days since it tends to get updated too slowly for a lot of projects).

First get a copy of libjpeg and build it as a shared library:

curl -O http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar -zxf jpegsrc.v7.tar.gz
cd jpeg-7/
ln -s `which glibtool` ./libtool
./configure --enable-shared --prefix=/usr/local
make
sudo make install

Now get a copy of ImageMagick:

curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar -zxf ImageMagick.tar.gz
cd ImageMagick-*/
./configure --prefix=/usr/local
make
sudo make install

Now you should have convert, mogrify, montage or whatever other ImageMagick tools you were interested in. RMagick seems to install just fine after you do this, though I couldn’t get gruff working because of what looks like a dependency on GhostScript. I’ll update this post once I get that worked out.

Update (8/26): Tweaked some of the commands here to account for new versions of libjpeg and ImageMagick. Thanks for the heads up, Amed!