Ruby: Installing rmagick on Ubuntu

83,786

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
Share:
83,786
Ciaran Archer
Author by

Ciaran Archer

Ciarán Archer works for Zendesk. https://github.com/ciaranarcher

Updated on December 22, 2020

Comments

  • Ciaran Archer
    Ciaran Archer over 3 years

    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!

  • Ciaran Archer
    Ciaran Archer over 13 years
    This (imagemagick and libmagickwand-dev) appears to have worked and I can see RMagick 2.13.1 as one of my listed gems!
  • esilver
    esilver over 11 years
    To clarify for 12.04: sudo apt-get install libmagickwand-dev graphicsmagick-libmagick-dev-compat
  • umassthrower
    umassthrower over 11 years
    As I commented below, worked fine for me just now with just libmagickwand-dev and I didn't need any additional packages. At least for Magick::ImageList.from_blob, Magick::ImageList.resize, and Magick::ImageList.write. Not sure about other methods.
  • alexpls
    alexpls almost 11 years
    Thanks for this - it was the only solution here that worked for me.
  • Dan Allen
    Dan Allen almost 10 years
    I can confirm this worked on Ubuntu 14.04. As a side note, you also need the packages ruby-dev and make...which may already be there on a typical system, but weren't there on the docker image.
  • Ashburton88
    Ashburton88 over 9 years
    You also need the imagemagick package: github.com/rmagick/rmagick/wiki/Installing-on-Ubuntu
  • Ashburton88
    Ashburton88 over 9 years
    You should install imagemagick as well: github.com/rmagick/rmagick/wiki/Installing-on-Ubuntu
  • Ashburton88
    Ashburton88 over 9 years
    You should install imagemagick as well: github.com/rmagick/rmagick/wiki/Installing-on-Ubuntu
  • Ashburton88
    Ashburton88 over 9 years
    You should install imagemagick as well: github.com/rmagick/rmagick/wiki/Installing-on-Ubuntu
  • Ashburton88
    Ashburton88 over 9 years
    You should install imagemagick as well: github.com/rmagick/rmagick/wiki/Installing-on-Ubuntu
  • Kabir Sarin
    Kabir Sarin over 9 years
    After searching for about an hour, Dan Allen's comment ^ (about installing make and ruby-dev) finally fixed it. Thanks!
  • Tomer
    Tomer almost 9 years
    This is by the far the quickest answer! AMAZING!
  • bjmc
    bjmc almost 9 years
    Thank you so much. I think all the other Ubuntu answers are outdated.
  • Dalibor Filus
    Dalibor Filus over 8 years
    On Ubuntu 14.04 LTS you have to first install libmagickcore-dev and then libmagickwand-dev, otherwise apt-get will refuse to install the wand dev package. (You should be able to install them in one command line, as follows: sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev) (source: askubuntu.com/questions/112548/rmagick-install-problem/…)
  • Greg
    Greg about 8 years
    In my case - after a lot of trying, apt-get told me that libmagickwand-dev requires libmagickcore-dev but is not going to be installed. I run sudo apt-get install libmagickcore-dev before magigwand and it helped :)
  • nroose
    nroose about 8 years
    Thanks. That worked for me after upgrading 14.04 to 16.04.
  • ZombieBsAs
    ZombieBsAs over 7 years
    Do not forget to do: sudo apt-get update before this.
  • Dinesh Kumar Soni
    Dinesh Kumar Soni almost 6 years
    On Ubuntu 16.04 LTS, when i run the command sudo apt-get install imagemagick libmagickwand-dev. Its giving error The following packages have unmet dependencies: libmagickwand-dev : Depends: libmagickwand-6.q16-dev but it is not going to be installed
  • Dinesh Kumar Soni
    Dinesh Kumar Soni almost 6 years
    This solution not working in Ubuntu 16.04 LTS, when run the command sudo apt-get install imagemagick libmagickwand-dev, giving error "The following packages have unmet dependencies: libmagickwand-dev : Depends: libmagickwand-6.q16-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages"