Installing RMagick on Mac OS X

by woody2shoes on August 19, 2009

RMagick is the Ruby wrapper for ImageMagick—the open source API for image manipulation. RMagick is used for graphing with the Gruff gem and many other things in Ruby and Ruby on Rails.

Installing RMagick on Mac OS X is pretty simple, but not as simple as typing gem install rmagick but pretty close.

First, you need ImageMagick. You can use MacPorts to install ImageMagick. If you don’t have it, you can get instructions for installing it here.

sudo port install imagemagick +q8 +gs +wmf

The installation takes a little time, but does the job.

Once you have ImageMagick installed, you can install rmagick normally.

sudo gem install rmagick

I did run into one issue when doing this. MacPorts changed my path to include their /opt directories. Because I had installed ruby and gems in those folders before, my mac installation was looking for the gem command there. You can fix this by opening your .bash_login file and editing your path.

vim ~/.bash_login

Change this line:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

to look like this:

/opt/local/bin:/opt/local/sbin

Then try installing the gem again.

sudo gem install rmagick

Previous post:

Next post: