post icon

Installing ImageMagick on Mac OS X Leopard

I recently just got the 24inch iMac and had to undergo the massive task of porting over everything from my MacBookPro. This included installing all the needed custom installs of Ruby, Rails, ImageMagick, RMagick, MySQL and configuring everything to work properly. I had the most trouble with ImageMagick, although it wasn’t that hard It still took me a bit to do. Now I hate mac ports, well I don’t hate but I don’t like how it install stuff everywhere. I like being able to control what’s being installed in a tidy fashion. So this is what I did to get ImageMagick working:

The easy way is to use the ruby installer for ImageMagick and RMagick found on the rubyforge website. Look for the: rmagick-osx-installer. Make sure you have correct PATH variables setup in your .bash_login or your new install will not be picked up because it installs to /usr/local.

Download that and do the following after you cd to the dir that it was downloaded to:

cd /path/to/folder/rm_install-1.*
sudo ruby rm_install.rb

If ya wanna get funky with it the the following explains how to install ImageMagick into your own folder and get it configured to work. Be sure to backup. There are some issues as well with RMagick not installing properly so if you need RMagick the above is a better approach.

First I always read up on hivelogic cause Dan Benjamin is one smart cookie when it comes to this stuff. He explains that creating /usr/local and /usr/local/src and installing everything in there is good for many reasons.

First I download all my custom installs in /usr/local/src/ so if you need to create these dirs:

sudo mkdir -p /usr/local/src

That creates both directories. Then we need to go to the src directory and download the tarball and unpack it. I use wget but you can use curl if you don’t have wget installed, so don’t do both the wget and curl commands below… as they do the same thing.

cd /usr/local/src
wget http://www.imagemagick.org/download/binaries/ImageMagick-universal-apple-darwin9.5.0.tar.gz
curl http://www.imagemagick.org/download/binaries/ImageMagick-universal-apple-darwin9.5.0.tar.gz -O
tar xzvf ImageMagick-universal-apple-darwin9.5.0.tar.gz

Then we need to setup the environment variables to properly load ImageMagick so that we can use it in our applications. If you don’t know what environment variables are then go research it first.

If you don’t have a .bash_login in your $HOME dir then we need to create one. Go to your home dir first then create it or if its already there you can open it with nano or any other editor you like. I prefer nano cause it’s quick and I can run all the commands right in my terminal window. Then write in your paths.

cd ~
touch .bash_login
nano .bash_login

Your .bash_login should look something like this:

export MAGICK_HOME="/usr/local/src/ImageMagick-6.4.4"
export PATH="$MAGICK_HOME/bin:/usr/local/lib:/usr/local/mysql/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

Exit out of your shell and close the window then open a new window and type:

echo $MAGICK_HOME

You should see this:

/usr/local/src/ImageMagick-6.4.4

Now echo the DYLD_LIBRARY_PATH

echo $DYLD_LIBRARY_PATH

You should see this:

/usr/local/src/ImageMagick-6.4.4/lib

If you do then your setup properly and everything should work fine. Try this:

convert logo: logo.gif
display logo.gif

If you have x11 installed you should see a image open! That means your system is now setup with ImageMagick and your good to go! Hope this helps someone get through the process a little faster than I did, cause the instructions on the ImageMagick site suck.

1 Comment

Leave a comment
  1. Sandar
    11. Apr, 2009 at 11:17 pm #

    Thanks a lot!
    This IM was driving me crazy (almost). Difficult to figure out.