Skip to content

Web nourishment by John Ford and crew

Installing ImageMagick/RMagick on Leopard

John Ford Nov 26, 2007

I’ve heard many horror stories of developers trying to install ImageMagick/RMagick to manipulate images. Fortunately, when I needed to install RMagick to use with the attachment_fu plugin, I ran across a fantastic script at OnRails.org by Solomon White (many thanks). It gave the steps to install RMagick from source without MacPorts or Fink.

I made the following minor changes to get it working for me and posted the script below.

  • Changed ‘wget’ to ‘curl -O’
  • Updated a couple of links that weren’t working for me
  • Updated sourceforge links to the east coast
  • Updated links to latest version of source code (as of today)
#!/bin/sh
curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.23.tar.bz2
tar jxvf libpng-1.2.23.tar.bz2
cd libpng-1.2.23
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/wvware/libwmf-0.2.8.4.tar.gz
tar xzvf libwmf-0.2.8.4.tar.gz
cd libwmf-0.2.8.4
make clean
./configure
make
sudo make install
cd ..

curl -O http://www.littlecms.com/lcms-1.17.tar.gz
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
./configure
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.61.tar.gz
tar zxvf ghostscript-8.61.tar.gz
cd ghostscript-8.61/
./configure  --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/current/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-1.tar.gz
tar xzvf ImageMagick-6.3.7-1.tar.gz
cd ImageMagick-6.3.7
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --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 ..

To test that ImageMagick was installed properly you can check the version number.

convert -version

[you should see something like this]
Version: ImageMagick 6.3.7 11/26/07 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

To test that ImageMagick is working properly you can run the following test. It will create a copy of the ImageMagick logo.

convert logo: logo.gif
Digg!

Comments

  1. James
    December 21st, 2007 | 5:29 am

    Many thanks for this, it really helped.

  2. Sman
    January 4th, 2008 | 5:10 pm

    I am curious about something and have been unsuccessful in resolving it. I can easily install ImageMagick on Leopard. What I am having a hard time with is getting the correct gem for 6.3.7. The RMagick gem I keep getting is built for a different version of ImageMagick making it impossible to get this thing working. I am kinda new at the rails environment, so I could be just doing something wrong. Do you have the correct gem and can verify it works in the rails framework. Just an FYI, convert -version works fine with my ImagicMagick install. Its the in rails app usage that fails. Thanks in advance.

  3. January 7th, 2008 | 1:50 pm

    Hi Sman, I’m running ImageMagick 6.3.7 and the gem rmagick 2.0.0 on my local machine. I’m using attachment_fu in one of my projects and images are being resized properly. I just now tested again to make sure.

  4. Craig
    February 29th, 2008 | 1:18 am

    Has anyone ran into the problem of the littlecms website being down and therefor unable to download the source? If so, does anyone know of any mirrors to download it from. I have been googling for the last little while and have not been able to find anything.

  5. February 29th, 2008 | 7:15 am

    Hi Craig, the littlecms site seems to be coming up okay now.

  6. March 3rd, 2008 | 4:25 am

    I’ve run into a snag with the script over at OnRails … i *thought* everything was working fine for a week or two … my rails project using attachment fu let me upload images, and would create the thumbnails sizes I asked for … BUT … it would nto do so if the original image was a jpg.

    I’m going to try this more recent version of the script and hope for the best :)

    Any thoughts on why jpgs would be an issue? anyone else had that problem with leopard?

  7. March 16th, 2008 | 6:34 pm

    Nice work! Did the job perfectly.

  8. March 17th, 2008 | 8:10 pm

    Many thanks to you and Solomom for sharing this.

  9. Josh
    May 2nd, 2008 | 7:07 am

    Thanks for sharing this… had to change some URLs and stuff to get it work, but it helped a lot!

Leave a reply