While prepping a development server earlier this afternoon I ran into an issue installing the rmagick gem. This was one of a list of 30 or so gems required by a Ruby project that was being installed onto the development server. I thought initially something else was wrong because I had run into this issue before but I thought I had installed ImageMagick via the yum package manager to resolve the problem. Anyhow after verifying ImageMagick was installed I still had the same issue on the development CentOS Linux server. Below I describe the error in detail along with what was done to resolve the issue.

Error Installing rmagick Gem On CentOS Linux Server:

[root@cent2 rubygems-1.3.5]# gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.7.0. Can't find Magick-config in /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/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.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.7.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.7.0/ext/RMagick/gem_make.out

After reading the above error output I decided to also check the mkmf.log file as suggested. The below example output is from the mkmf.log file that had pretty much the same information as the initial error.

CentOS rmagick Gem Install Error: mkmf.log

[root@cent2 rubygems-1.3.5]# less /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.7.0/ext/RMagick/mkmf.log
checking for Ruby version >= 1.8.2... -------------------- yes

--------------------

find_executable: checking for gcc... -------------------- yes

--------------------

find_executable: checking for Magick-config... -------------------- no

--------------------

Can't install RMagick 2.7.0. Can't find Magick-config in /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

After reviewing the mkmf.log file I did a little research which suggested installing the libmagick9-dev package which isn’t available on CentOS Linux. I finally remembered that the ImageMagick-devel package must also be installed for the rmagick gem to install without issue. Below is output from installing the ImageMagick-devel package followed by a successful installation of the rmagick gem on CentOS Linux.

Install ImageMagick-devel Using Yum Package Manager On CentOS:

yum install ImageMagick-devel

Successful rmagick Gem Install On CentOS Linux:

[root@cent1 rubygems-1.3.5]# gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.7.0
1 gem installed
Installing ri documentation for rmagick-2.7.0...
Installing RDoc documentation for rmagick-2.7.0...

That is it. The rmagick gem is now installed without issue.

The Definitive Guide to CentOS (Books for Professionals by Professionals) (Paperback)

By (author): Peter Membrey, Tim Verhoeven, Ralph Angenendt


List Price: $39.99 USD
New From: $23.41 USD In Stock
Used from: $17.32 USD In Stock


List Price: $39.99 USD
New From: $7.94 USD In Stock
Used from: $0.01 USD In Stock

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , ,
13 Responses to “CentOS Linux: Can’t install RMagick 2.7.0. Can’t find Magick-config”
  1. Ramon says:

    How did you install a late version of ImageMagick? When I install rmagick, it complains that I have an old version of ImageMagick (which I installed via yum).

    sudo gem install rmagick gives me this, among other errors:
    “Can’t install RMagick 2.13.1. You must have ImageMagick 6.4.9 or later.”

    [Reply]

    alex Reply:

    Hello Ramon,

    What based OS are you running? My current ImageMagick version on the server above is only 6.3.5.9-1 and as you see above it installed fine on the server above.

    Thanks,
    alex

    [Reply]

  2. Ramon says:

    CentOS 5.5 – so I thought the OS being old wasn’t an issue :) I followed http://rha7dotcom.blogspot.com/2008/09/how-to-install-imagemagick-and-rmagick.html to get it installed instead, but I understand that it will be more difficult for me to update it in the future.

    [Reply]

    alex Reply:

    Hello Ramon,

    Thanks for the follow up. I have had to install newer ImageMagick versions in the past for various projects and yeah it is a little bit more of a pain installing/upgrading outside of yum but guess we have to do what we have to do. :) Regardless I am glad you got it taken care of. Thanks again for taking the time to respond.

    Thanks.
    alex

    [Reply]

  3. Ramon says:

    Thanks! And thanks too for posting up these things. It helps us noobs!

    [Reply]

    alex Reply:

    Hello Ramon,

    No problem. Thank you for taking the time to post feedback regarding our article on installing the rmagick gem.

    Thanks.
    alex

    [Reply]

  4. Nalgatron Sanchez says:

    Great Job ALEX!

    [Reply]

    alex Reply:

    Hello Nalgatron Sanchez,

    Thank you! We always appreciate it when people take the time to leave feedback regarding the articles we post.

    Thanks.
    alex

    [Reply]

  5. Anna says:

    Thanks so much- I also had ImageMagick installed for a perl/LAMP environment, and had to setup for Rails. So glad I found your post!

    [Reply]

    alex Reply:

    Hello Anna,

    No problem at all. Glad the article helped you out. Thanks for taking the time to leave feedback.

    Thanks.
    alex

    [Reply]

  6. tquang says:

    It not for me, doesn’t work

    ======

    [root@centos redmine-1.4]# rpm -qa | grep ImageMagick
    ImageMagick-6.2.8.0-15.el5_8
    ImageMagick-perl-6.2.8.0-15.el5_8
    ImageMagick-devel-6.2.8.0-15.el5_8
    ImageMagick-c++-devel-6.2.8.0-15.el5_8
    ImageMagick-c++-6.2.8.0-15.el5_8

    [root@centos redmine-1.4]# cat /etc/redhat-release
    CentOS release 5.8 (Final)

    [root@centos redmine-1.4]# uname -a
    Linux centos 2.6.18-308.13.1.el5 #1 SMP Tue Aug 21 17:10:06 EDT 2012 i686 i686 i386 GNU/Linux

    [root@centos redmine-1.4]# gem install rmagick
    Building native extensions. This could take a while…
    ERROR: Error installing rmagick:
    ERROR: Failed to build gem native extension.
    /usr/local/bin/ruby extconf.rb
    checking for Ruby version >= 1.8.5… yes
    checking for gcc… yes
    checking for Magick-config… yes
    checking for ImageMagick version >= 6.4.9… no
    Can’t install RMagick 2.13.2. You must have ImageMagick 6.4.9 or later.
    *** 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.
    Provided configuration options:
    –with-opt-dir
    –without-opt-dir
    –with-opt-include
    –without-opt-include=${opt-dir}/include
    –with-opt-lib
    –without-opt-lib=${opt-dir}/lib
    –with-make-prog
    –without-make-prog
    –srcdir=.
    –curdir
    –ruby=/usr/local/bin/ruby
    Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.13.2 for inspection.
    Results logged to /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

    [Reply]

  7. tquang says:

    rmagick need ImageMagick >= 6.4.9 :(
    centos 5 not in yum repo

    [Reply]

  8. wwek says:

    Great Job ! thx!

    [Reply]

  9.  
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*