报错信息如下:
jinguoli@MacBook:~$sudo gem install rmagick
Password:
Building native extensions. This could take a while…
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension./System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install rmagick
checking for Ruby version >= 1.8.2… yes
checking for 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… yes
checking for sys/types.h… yes
checking for magick/MagickCore.h… yes
checking for InitializeMagick() in -lMagick… no
checking for InitializeMagick() in -lMagickCore… no
checking for InitializeMagick() in -lMagick++… no
Can’t install RMagick 2.7.2. Can’t find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
–with-Magicklib
–without-Magicklib
–with-MagickCorelib
–without-MagickCorelib
–with-Magick++lib
–without-Magick++libGem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.7.2 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.7.2/ext/RMagick/gem_make.out
jinguoli@MacBook:~$
即使在~/.bash_profile下设置了MAGICK_HOME/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH也不管用,于是乎无耻一下,直接在修改Magick-config/Magick++-config/MagickCore-config文件的prefix=$MAGICK_HOME之前加入:
MAGICK_HOME=’/usr/local/ImageMagick’
然后再次安装:
jinguoli@MacBook:~$sudo gem install rmagick
Password:
Building native extensions. This could take a while…
Successfully installed rmagick-2.7.2
1 gem installed
jinguoli@MacBook:~$gem list|grep rmagick
rmagick (2.7.2)
OK, 问题解决。