Thursday, June 14, 2007

Getting RMagick running on MAC OSX in 3 easy steps (with MacPorts)

After figuring out (with some help) how to get RMagick running on debian, I had to get it running on my development notebook - a MacBook with Mac OSX 10.4 (Intel).

To keep things simple I really like to use MacPorts to install new software onto the Mac.

So here we go:
1. Install ImageMagick with MacPorts (this takes some time - get a coffee NOW):
sudo port instll ImageMagick +graphviz +gs +jbig +jpeg2+lcms +mpeg +nox11 +wmf

MacPorts just installed ImageMagick in /opt/local/lib. Mac OSX includes by default /lib, /usr/lib, and /usr/local/lib as library path.
2. All we have to do, is to "show" gem where we installed imagemagick:
export LD_LIBRARY_PATH=/opt/local/lib

3. Now we can install RMagick on the Mac without any problems:
sudo gem install RMagick

Now check that it did really worked:
irb -rubygems -r RMagick
(now enter) puts Magick::Long_version

Done :)


BTW: I don’t get - After the installation, I started a completely new terminal and check it again:
irb -rubygems -r RMagick
(now enter) puts Magick::Long_version

And it works – but this time the LD_LIBRARY_PATH variable is not set!

1 comment:

Bug said...

The export command only sets environment variables per-session. You could put that command in ~/.profile or something, but that will only work for Terminal sessions. It would probably be better to edit the XML file ~/.MacOSX/environment.plist, so that the variables are set when you log in.

Since RMagick seems to load without that variable, though, you might be able to skip it...