简体   繁体   中英

How to install rmagick on Mac OS X Mountain Lion?

I'm trying to install rmagick on Mountain Lion.
I've installed ImageMagick successfully by Homebrew, but I can't install rmagick gem. My ruby environment is managed by rvm and installed ruby 1.8.6.

I've got an error below when tried to install rmagick.

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

/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for magick/MagickCore.h... no
Can't install RMagick 2.7.2. Can't find MagickCore.h.

The erros shows that counldn't find MagickCore.h, but I found in /usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h
I guess if I can manage to tell installer this path, it will go well but I've no idea to do it.

I've googled and found similar questions below.
Can't install rmagick in Mountain Lion
"rmagick" gem installation issue
And tried to pass PKG_CONFIG_PATH and C_INCLUDE_PATH before 'gem install' command, and wrote them to ~/.bash_profie, and build ImageMagick from source, but nothing changed.

Does anyone know how to fix it?

Here you'll find the answer. I had the same issue and this solved perfectly!

Rails and OS X: How to install rmagick?

rmagick has a problem working with imagemagick (>= 6.8.0-10) from homebrew.

You can either

update rmagick gem by

bundle update rmagick

or manually symbol link some dylib to make it work:

$ cd "`Magick-config --prefix`lib"
$ ln -s libMagick++-Q16.7.dylib   libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib

After that gem install rmagick should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM