Installing ImageMagick and RMagick on Mac OS X

Written by on Sep 26 2007

I have found a new way of doing this that is so good I can’t believe I haven’t heard about this before. It turns out, there is a one click (command) installer for ImageMagick and RMagick and nobody is talking about it. If you go to the RMagick home page and look though the FAQ you will see the first choice is to use the installer script. Choices two and three both revolve around Ports, so we can all ignore those from now on.

Here is how to do it:

  • If you already have ports installed with a version of ImageMagick, but not RMagick, you may have to remove the opt entries from your ~/.bash_profile or ~/.bash_login file.
  • Go here and download the “rmagick-osx-installer.”
  • You probably already have XCode installed, but do you have the X11 SDK installed? Probably not, because it is not installed by default.

    • Go back to the XCode installer, either the one you downloaded or the one on the Mac OS X install disk.
    • Rerun the installer, but this time when you are on the “Choose your installation type” (or something) screen of the install wizard, click the little “Customize” button on the lower left. I know, I missed it too the first time through.
    • Make sure X11 SDK is select in one of the sub-folders (I can’t recall which one).
  • UPDATE: Ignore this step if you are on Leopard. Make sure you have X11 also installed. Yes, this is different from the SDK. This page will tell you how easy it is to do that.

  • Did the “rmagick-osx-installer” finish downloading and automatically unzip to a folder on your desktop called “rm_install-1.0.2 Folder?”

  • Using (i)Term navigate to that folder and run: “ruby rm_install.rb”

  • Did you get an error that says something like “The installation directory ‘xxx’ contains blanks. Some of the install scripts for the dependent libraries can’t handle directory names with embedded blanks. Please choose another directory.”

  • I think this is probably the biggest reason why this installer is not more popular, I had no idea what this error meant. I had to look in the source code to figure out that the path to the rm_install.rb is not allowed to contain spaces (blanks). Then why did it unzip to a folder whose name has a space in it?

  • OK, cd ../ && mv rm_install-1.0.2\ Folder rm_install-1.0.2 && cd – (Or: rename the directory so it has no spaces.)

  • Run the installer again and it should automagickally install RMagick, ImageMagick, and all dependencies.

Now I know what you are thinking, “Steve, if you’re installing RMagick did you get a brand new computer?!” And the answer is sorrowfully no. But what I did have is my SECOND hard drive failure in six weeks. That means that this is my third hard drive on a computer that is less than one year old. And I am excited because I am sure I will have to reinstall all of my gems (including RMagick) and ImageMagick next month when Leopard comes out. Happy, happy, joy, joy. But at least I finally found the right way to do it!

3 Comments

Kiere El-Shafie
Kiere El-Shafie said on September 27, 2007

That is awesome. I got a new MacBook Pro last week and I remember what a pain IM was to install on the last one. Good to know it will be less painful this time.

chris
chris said on September 27, 2007

This is awesome, I had so much trouble with ports trying to install ruby for me that I just 86ed it and installed IM by hand. What a nightmare. Thanks again.

Michael Christenson II
Michael Christenson II said on October 24, 2007

One note. After running the script and opening up irb, a require ‘rubygems’;require ‘rmagick’; was failing on the rmagick bit. I’m not sure why, but I did a sudo gem install rmagick which seemd to finish off the install. Works now. Thanks for the post Steve.

Meet
Steven

Hi I'm Steven,

I wrote the article you're reading... I lead the developers, write music, used to race motorcycles, and help clients find the right features to build on their product.

Get Blog Updates