I recently upgraded the server running 5 Blocks Out from Ubuntu version 8.0.4 to 10.04. Somewhere along the way the binding between the rmagick gem and the underlying imagemagick libraries broke, probably because Ubuntu upgraded imagemagick on my behalf. And as I discovered over coffee this morning, if your Rails app depends on rmagick, and rmagick can’t bind to imagemagick, you’re hosed. So… here’s the solution I found after some panicked schnoozling around the web.
First, the error: when trying to start Rails you get an error that looks like this:
libWand.so.10: cannot open shared object file: No such file or directory - /opt/ruby-enterprise-1.8.6-20090520/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick2.so
As you can see, we’re running REE (Ruby Enterprise Edition). This complicates matters a little, because you need to ensure you install rmagick in the directory where REE expects it to be.
Here is the series of magic chants needed to get rmagick and imagemagick working together on Ubuntu 10.0.4 with REE (Ruby Enterprise Edition).
$ sudo apt-get install imagemagick $ dpkg -l | grep imagemagick ii imagemagick 7:6.5.7.8-1ubuntu1 image manipulation programs
You can see we picked up imagemagick v6.5.7.8.
Next, verify where your REE binaries are installed, and install rmagick, making sure it ends up in the REE gem directory:
$ which ruby /opt/ruby-enterprise-1.8.6-20090520/bin/ruby $ sudo /opt/ruby-enterprise-1.8.6-20090520/bin/gem install rmagick
This step can take a while. Once it completes, check to see that rmagick is bound properly to imagemagick:
$ irb -rubygems -r RMagick >> puts Magick::Long_versionThis is RMagick 2.13.1 ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter Built with ImageMagick 6.5.7-8 2009-11-26 Q16 http://www.imagemagick.org Built for ruby 1.8.6 Web page: http://rmagick.rubyforge.org Email: rmagick@rubyforge.org=> nil
If that works, start the Rails console and try the same thing. You should get the same results, and the fact that console runs is a good indicator your app server will probably run too.
Done!
References:
- http://stackoverflow.com/questions/4206428/rmagick-broken-on-ubuntu-10-04-after-upgrading-from-8-04
- http://rubyforge.org/frs/shownotes.php?release_id=43232
- http://rmagick.rubyforge.org/install2-linux.html
- http://wiki.slicehost.com/doku.php?id=upgrade_ubuntu-server_lts_to_lts
Filed under: stupid stupid stupid, technology Tagged: imagemagick, rails, REE, rmagick, ruby, ubuntu, upgrade Image may be NSFW.
Clik here to view.

Clik here to view.
