Getting rmagick on Leopard (OS X 10.5)

As you might be well aware, the latest OS X version includes ruby (1.8.6) and rails (1.2.3) installed plus a few other gems into /Library/something. Which means: system-wide, and apple might upgrade them in later minor upgrades to leopard. There’s already upgrades to the 1.2 rails line and rails 2.0 will be out soon (if not already out).

So, basically rmagick is not included amongst the gems. If you wanna do anything about image manipulation in your rails app, then you just can’t live without it. Period.

I decided to install macports this time, with my new Leopard installation. I had concerns against its default /opt install location (I would just have preferred /usr/local) but now that I did some reading on their website I know why they needed to choose that path. Here are the steps:

  1. Install the XCode developer tools (with the X11 sdk, bit it’s default I guess) from your snazzy little Leopard DVD you just bought.
  2. Download the latest macports package for OS X 10.5 (link)
  3. Install it (will take a short while, as it updates its package list upon install)
  4. If you have not created a ~/.bash_login or ~/.bash_profile or ~/.profile file in your home or you have no idea what these are then skip to 6 (and learn about them by the way)
  5. After macports has done if you have an old .profile or .bash_profile or .bash_login file first of all keep only one of them and organize your shit so that all what’s needed is in one file that you keep. Now open ~/.profile that the macports install has created and copy the lines from it to your chosen file.
  6. open up Terminal.app from /Applications/Utilities and type port. It should greet you with a few lines. Now type quit to exit from it. If it says something ending with command not found - you fucked up something. Try to close all Terminal instances and reopen and retry. If still no success try to google for a solution or read more carefully what I write.
  7. The following is courtesy of this guy. All the below are typed into a terminal window. The command(s) will ask for your password. Do not panic.
  8. sudo port -v install tiff -macosx
  9. sudo port -v install ImageMagick
  10. sudo gem install rmagick
  11. All should compile under 15 minutes on a decent macbook pro. You will see lots of lines from gcc and make scrolling by - just enjoy. At the end you can test for a successful install by typing “gem list rmagick”. At the time of compilation I got rmagick (1.15.10) installed.

For the more technically inclined: when you install rmagick bu sudo gem install … it puts it under /Library/Ruby/Gems/1.8/gems/rmagick… That’s why you need to ’sudo’-it. It is a bit of a disappointment though as I thought I might be able to install my own gems into my user home. Well the positive side of things this way is that all users of the system can access these gems. :) Even if you are the only user…


About this entry