Wednesday, April 27, 2011

Installing rmagick on ubuntu 10.04

I just installed ruby and rmagick on an ubuntu 10.4 server. Got some errors during the installation and thought i should summarize the procedure here:

Install ruby

sudo apt-get install ruby1.9.1 rubygems1.9.1


Install imagemagick


sudo apt-get install imagemagick


Tried to install rmagick

sudo gem install rmagick


Got this error:

ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

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


Found this page, which pointed med to install ruby1.9.1-dev package.


sudo apt-get install ruby1.9.1-dev


Ok, trying again to install rmagick

sudo gem install rmagick


Got this error:

ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.


Found this question on superuser.com which pointed me to install the libmagickwand-dev-package.

sudo apt-get install libmagickwand-dev


Finally, another attempt to install rmagick

sudo gem install rmagick




Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Updating class cache with 0 classes...
Installing RDoc documentation for rmagick-2.13.1...


Success!

3 comments:

  1. Thanks alot.. it worked for me :)

    ReplyDelete
  2. I tried

    sudo apt-get install libmagickwand-dev

    getting dependencies issuses

    The following packages have unmet dependencies:
    libmagickwand-dev: Depends: libmagickwand2 (= 7:6.5.7.8-1ubuntu1) but 7:6.5.7.8-1ubuntu1.2 is to be installed
    Depends: libmagickcore2-extra (= 7:6.5.7.8-1ubuntu1) but 7:6.5.7.8-1ubuntu1.2 is to be installed
    Depends: libmagickcore-dev (= 7:6.5.7.8-1ubuntu1) but it is not going to be installed

    ReplyDelete
  3. prasanna: Are you using ubuntu 10.04 ?

    This is a rather old post and I would suggest using RVM (https://rvm.io/) for installing ruby on ubuntu. Much less hassle than installing with ubuntu packages.

    ReplyDelete