Installing RMagic on Debian/Ubuntu Linux

I’m working on an image manipulation program that requires the Ruby ImageMagick bindings, RMagick. I was unable to install RMagick from either the gem, or the Debian package. Building RMagick from source didn’t work either.

The following worked for both a Debian Sarge box, and an Xubuntu laptop. I hope it saves someone some grief.

$ dpkg -l | grep magick
  ii  imagemagick    6.0.6.2-2.7    Image manipulation programs
  ii  libmagick6     6.0.6.2-2.7    Image manipulation library
  ii  perlmagick     6.0.6.2-2.4    A perl interface to the libMagick
  ii  rubymagick     0.1.3-13       Ruby interface for ImageMagick

Get rid of the rubymagick package

$ apt-get remove --purge rubymagick

Install the dev versions of libmagick6 and Ruby 1.8 edit: for Xubuntu, install libmagick9

$ apt-get install libmagick6-dev ruby1.8-dev

Install rmagick from the gem

$ gem install rmagick

You can test the install by running a simple app like this, which will print the EXIF data from an image:

require 'rubygems'
require 'RMagick'

require 'pp'

img = Magick::Image.read('test.jpg').first
exif_data = img.get_exif_by_entry()

pp exif_data

Update:

As of Xubuntu 7.04 (Feisty Fawn), you need libmagick9-dev.

Share and Enjoy:
  • Twitter
  • del.icio.us
  • Facebook
  • Tumblr
  • email

One Response to “Installing RMagic on Debian/Ubuntu Linux”

  1. Mezza Says:

    Thanks for this, saved me some time.

Leave a Reply