Installing ImageMagick/RMagick on Leopard

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 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)
curl -O
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
sudo make install
cd ..

curl -O
tar jxvf libpng-1.2.23.tar.bz2
cd libpng-1.2.23
./configure --prefix=/usr/local
sudo make install
cd ..

curl -O
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
./configure --enable-shared --prefix=/usr/local
sudo make install
cd ..

curl -O
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
sudo make install
cd ..

curl -O
tar xzvf libwmf-
cd libwmf-
make clean
sudo make install
cd ..

curl -O
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
sudo make install
cd ..

curl -O
tar zxvf ghostscript-8.61.tar.gz
cd ghostscript-8.61/
./configure  --prefix=/usr/local
sudo make install
cd ..

curl -O
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

curl -O
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
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
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

19 Responses

  1. Many thanks for this, it really helped.

  2. 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. 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. 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. Hi Craig, the littlecms site seems to be coming up okay now.

  6. 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. Nice work! Did the job perfectly.

  8. Many thanks to you and Solomom for sharing this.

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

  10. For people like me who do not have X11 installed on their Leopard machine, this may help:

    I needed to add a
    to the end of the
    ./configure […]
    line, four lines up from the end of the script, in order for ImageMagick to install.

    Thanks for the script though!

  11. I had some problems with the last couple groups of commands. I don’t know if ImageMagick 6.3.7-1 is still available on their ftp?

  12. Hey John, thanks a lot to you and Solomon for blogging this!

    Tom: I modified John’s script slightly to use the latest versions from mirrors near me (UK). ImageMagick is currently at 6.4.2-0, so try:

    curl -O

    Hope this helps!

  13. I get the following error when trying to run his script:
    Undefined symbols:
    “_iconv_close”, referenced from:
    _opvp_to_utf8 in gdevopvp.o
    “_iconv”, referenced from:
    _opvp_to_utf8 in gdevopvp.o
    “_iconv_open”, referenced from:
    _opvp_to_utf8 in gdevopvp.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [bin/gs] Error 1

    Any ideas what is missing?

  14. ImageMagick-6.4.4 release doesn’t have the configure so you just unpack and configure your environment paths correctly and your good to go. I posted about it on my site. ;) Hope that helps someone out cause it frustrated the hell out of me.

  15. @Don French

    i had the same problem on 10.5 while compiling ghostscript. my fix involved downloading libiconv and compiling that. then make clean on ghostscript (imagemagick in your case) and then make -j1

  16. Thank you!! Fantastic help.

    I was just trying to run the unit tests for Paperclip on my Mac and realized they relied on ImageMagick… this script saved me!

  17. I have tried to install ImageMagick for 2 weeks on Mac OS Leopard without success. Everybody talked about usr/local/bin and I was not able to install it in that directory. Thanks to this script I could. I only used the last 9 lines of the script that installs ImageMagick, is that wrong? I still have a problem. I can use ImageMagick from the terminal and it works perfect. But why can’t I use it from PHP code with the exec command?

  18. @Benny, you may have to recompile PHP with the GD flag to enable it. When I compile PHP on my system it looks something like this:

    ./configure \
    --prefix=/usr \
    --with-apxs2 \
    --with-curl \
    --enable-fastcgi \
    --enable-zip \
    --with-zlib=/usr \
    --enable-ftp \
    --enable-sockets \
    --with-openssl \
    --with-ldap=/usr \
    --with-kerberos=/usr \
    --enable-cli \
    --with-xmlrpc \
    --with-xsl=/usr \
    --with-mysql=/usr/local/mysql \
    --with-mysql-sock=/tmp/mysql.sock \
    --with-mysqli=/usr/local/mysql/bin/mysql_config \
    --with-gd \
    --with-jpeg-dir=/usr/local/lib \
    --with-png-dir=/usr/X11R6 \
    --with-freetype-dir=/usr/X11R6 \
    --with-xpm-dir=/usr/X11R6 \
    --enable-exif \
    --with-mcrypt \

Leave a Reply

Your email address will not be published. Required fields are marked *