15

I have trouble installing rmagick. I am developing my project using ruby on rails framework. I included rmagick gem in my gemfile. I am getting the following error message:

checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.4. You must have ImageMagick 6.4.9 or later.

I have installed imagemagick using brew:

 imagemagick-6.8.9-8 already installed

The imagemagick folder is resided in /usr/local/Cellar directory

In my terminal:

Zoulfias-iMac:Myapp zoulfiahall$ rvm use ruby-2.0.0-p481

Using /Users/zoulfiahall/.rvm/gems/ruby-2.0.0-p481
Zoulfias-iMac:Myapp zoulfiahall$ sudo gem install rmagick

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

/Users/zoulfiahall/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.4. 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=/Users/zoulfiahall/.rvm/rubies/ruby-2.0.0-p481/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /Users/zoulfiahall/.rvm/rubies/
ruby-2.0.0-  p481/lib/ruby/gems/2.0.0/gems/rmagick-2.13.4 for inspection.
Results logged to /Users/zoulfiahall/.rvm/rubies/
ruby-2.0.0-  p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-13/
2.0.0-static/rmagick-2.13.4/gem_make.out

Any advice will be appreciated.

MBJH
  • 1,571
  • 3
  • 17
  • 36

9 Answers9

42

This worked for me on ubuntu.

$ sudo apt-get install imagemagick
$ sudo apt-get install libmagickwand-dev

Now try again.

$ bundle install
justin.m.chase
  • 13,061
  • 8
  • 52
  • 100
  • 1
    Thank you for posting this. It works but I also need to install the ruby-rmagick with the command `#apt install ruby-rmagick` – mohit May 09 '17 at 12:27
  • if possible pls try to relate why we need to install these libraries for proper working of ImageMagick. Similarly in other cases as well. – Sunil Kumar Oct 28 '18 at 11:14
  • @RememberWhyYouStarted I have no idea why its needed. It seems like the library has a dependency on the development libraries rather than just the production binaries. I have no idea why, only that it works. – justin.m.chase Oct 29 '18 at 15:21
15

I had this same issue on macOS when attempting to run gem install rmagick -v 2.13.4

The trick to this is the rmagick installer (gems/rmagick-2.13.4/ext/RMagick/extconf.rb) checks the output of convert to determine the IM version. If that is not returning the correct version (or otherwise completely broken, as was my case), rmagick will not install.

I installed ImageMagick 6 via Homebrew and that fixed my issue. This snippet installs IM, adds it to your path, and runs the installer explicitly pointing to IM6.

$ brew install imagemagick@6
$ echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile
$ PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick -v 2.13.4

Good luck!

pmarrapese
  • 151
  • 1
  • 3
4

I had the same problem today. What is causing the problem is the fact that rmagick is out of date. And the gem is not being updated regularly. I wanted to present my solution for people who don't mind using older version of imagemagick. ( I believe it is up to 6.5.9-10)

  1. Uninstall imagemagick with all the components:

    brew uninstall --force imagemagick

  2. Install the older version of imagemagick by adding -ruby186 to the end of the command

    brew install imagemagick-ruby186

  3. Install rmagick :)

    gem install rmagick

  4. Enjoy!

Adrian Grzywaczewski
  • 868
  • 1
  • 12
  • 25
3

If do you installed imagemagick with brew install imagemagick@6

Before bundle install, run:

export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib"
export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
augustocbx
  • 762
  • 8
  • 8
1

Just had same issue. Try uninstall imagemagick and then install again:

brew uninstall --force imagemagick
brew install imagemagick

Then install rmagick. This worked for me.

jskierbi
  • 1,635
  • 1
  • 14
  • 22
  • 1
    This is the most minimalistic and straight-forward solution here and it worked well for me. I recommend others to try this one before trying the other ones. – adrianmcli Nov 06 '16 at 22:02
0

I filed a bug report for a similar issue at https://github.com/rmagick/rmagick/issues/126

I'm running crunchbang linux using debian sid.

It looks like you are on OSX. Consider filing your own bug report, if you havn't already.

Brian Takita
  • 1,615
  • 1
  • 15
  • 20
0

download and install http://xquartz.macosforge.org/trac/wiki/X112.7.2

brew uninstall imagemagick
brew link xz jpeg freetype    
brew install imagemagick
brew link --overwrite imagemagick
gem install rmagick

https://stackoverflow.com/a/32055126/3563993

Community
  • 1
  • 1
shilovk
  • 11,718
  • 17
  • 75
  • 74
0

This solved the issue for me in MacOS 10.14 Mojave

brew install pkg-config
PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.11-0/lib/pkgconfig gem install rmagick -v 2.16.0
Daniel Garcia
  • 1,382
  • 1
  • 10
  • 9
-1
brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config
brew link pig-config

sudo gem install rmagick

This worked for me.

Alexander
  • 9,074
  • 2
  • 15
  • 13