• Home »
  • Errors »
  • CentOS Linux: Can’t install RMagick 2.7.0. Can’t find Magick-config

CentOS Linux: Can’t install RMagick 2.7.0. Can’t find Magick-config

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: $22.22 USD In Stock
Used from: $6.92 USD In Stock


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

Share