Saturday, May 3, 2008

Getting RMagick to work after upgrading to Ubuntu Hardy

After upgrading from Ubuntu Gutsy to Heron last week, I could no longer run any of my ruby on rails applications that needed RMagick. I was getting the following error:

libMagick.so.9: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/rmagick-2.2.2/lib/RMagick2.so

The problem is that I had installed ImageMagick from source in Gutsy since the ImageMagick available from the repository was 6.2 and RMagick depends on ImageMagick 6.3. After the upgrade this didn't work anymore.

Turns out to be an easy fix. Since ImageMagick 6.3 is available from the Ubuntu repository in Hardy Heron, all I needed to do was this:

sudo gem uninstall rmagick
sudo apt-get install imagemagick
sudo gem install rmagick

Now everything is working fine again. That's sure a lot easier than building ImageMagick from source.

1 comment:

Chris said...

I just tried this on a fresh Hardy install, and the rmagick gem was failing because it couldn't find the Magick-config file. The following fixed it:

sudo aptitude install libmagick9-dev

It installs some 60 libraries that are needed. Then the rmagick gem installs fine.