Ruby: Installing rmagick on Ubuntu

I'm trying to get RMagick setup on Ubuntu 10.04. Looked here but had no joy. I even compiled and installed ImageMagick from source, but the instructions here still didn't help me when I try to install RMagick using RubyGems. I got this error:

carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
 ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
 from extconf.rb:1


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ 

What does it all mean? :) I'm new to Ruby and RubyGems so please be gentle. My setup is as follows:

Ruby: 1.8.7
RubyGems: 1.3.7

I'm pretty much out of ideas (and tired too!). I tired to compile RMagick from source using the link above but it failed as there was no ./configure script :(

Any and all help appreciated!


Solution 1:

Install the packages imagemagick and libmagickwand-dev (or libmagick9-dev). You should then be able to install the Rmagick Gem.

sudo apt-get install imagemagick libmagickwand-dev

If not, you are missing ruby related development packages like build-essential and ruby1.8-dev. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.

Solution 2:

You don't need a lot of the other junk in these answers, just:

sudo apt-get install libmagickwand-dev

Solution 3:

On Ubuntu 12.04 libmagick9-dev is gone. graphicsmagick-libmagick-dev-compat should be used instead.

apt-get install graphicsmagick-libmagick-dev-compat

Solution 4:

On Ubuntu 15.04, what solved it for me was to remove all previous *magick installations, reinstall required packages and then symlink the config file:

sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
gem install rmagick

Solution 5:

In Ubuntu 14.04


Below code is worked for me

sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

Then,

gem install rmagick