Ruby: Installing rmagick on Ubuntu

Viewed 85081

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!

15 Answers

In Ubuntu 13.10

This code worked for me

sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev

gem install rmagick

On Ubuntu, you can run:

sudo apt-get install libmagickwand-dev

On Centos, you can run:

sudo yum install gcc ImageMagick-devel make which

Then install

gem install rmagick

If you are using Linux then simply run these commands.

 sudo apt-get install imagemagick libmagickwand-dev

and then

 bundle install

Hope this will resolve your issue.

And if you are using mac then simply run following commands

First of all unlink your installed imagemagick which was not properly installed in latest mac high sierra by using.

 brew unlink imagemagick

then install latest imagemagic6 using below command

 brew install imagemagick@6 && brew link imagemagick@6 --force

Then install gem rmagick using below command

 gem install rmagick 

 bundle install

It will work perfectly fine.

Follow below 3 steps proven on UBUNTU 16.04

sudo apt-get install build-essential imagemagick libmagickwand-dev

#In .bashrc or .bash_profile add below code. Just check the ImageMagick dir name.
export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
gem install rmagic #Install Gem
Related