无法在Mountain Lion中安装rmagick

11
尝试使用sudo gem install rmagick在Mountain Lion上安装rmagick,出现了以下错误。希望得到帮助。论坛上的任何答案都没有起作用。
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for xcrun... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

你先安装了Imagemagick吗? - Frederick Cheung
是的,可能没有安装imagemagick。我建议在Mac上使用homebrew来安装imagemagick。 - Alper Karapınar
4个回答

20

这对我有用...

如早期答案所述:

$ brew remove imagemagick
$ brew install imagemagick --disable-openmp --build-from-source

我得到了magicwand.sh:

$ mdfind MagickWand.h -->
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/wand/MagickWand.h
我接着除了实际的文件名以外,删除了整个路径并添加了C_INCLUDE_PATH=,例如:
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/wand/
--->
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/

然后我寻找MagickCore.pc

$ mdfind MagickCore.pc
/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/MagickCore.pc
同之前一样:

这段内容保持不变。

/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/
--->
PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/

我随后使用gem install命令使用了这两个路径:

$ sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/ gem install rmagick

在经过数小时的研究后,最终它终于奏效了。希望能对某人有所帮助。


4
肯定帮助了至少一个人 :D - msfeldstein
非常感谢您! 我按照上面的步骤(卸载并重新安装)进行了操作, 但仍然出现错误“无法安装RMagick 2.13.2。找不到MagickWand.h。” 然后我按照您的步骤,成功地解决了问题。(我使用rvm,所以不需要sudo) 您为我节省了大量时间和巨大的头痛,谢谢! - J_McCaffrey
是的!终于在漫长的搜索后找到了。这就是它。 - Daniel Morris

17

使用Homebrew重新安装ImageMagick:

brew remove imagemagick
brew install imagemagick --disable-openmp --build-from-source

或者您可以使用以下shell脚本安装:

https://github.com/maddox/magick-installer

最终重新安装了OS X。感谢回复。 - Muthu
2
重新安装Homebrew时,第二个命令应该是"brew install imagemagick --disable-openmp --build-from-source"。我曾经一直在摸索,直到意识到这一点。但是如果你注意观察,你会发现没有"build"标志的源码构建速度太快了。 - Ganesh Shankar
有点晚了,但你是救命恩人。 - Seder

7

我一直在苹果电脑上安装 Rmagick 时遇到问题,尝试了许多不同的解决方案,但最终找到了一个有效的方法:

使用Homebrew重新安装 imagemagick:

$ brew remove imagemagick
$ brew install imagemagick --disable-openmp --build-from-source

然后

$ gem install rmagick -v '2.13.2'

感谢Andrew Nesbitt和Phillipe Gustavo发布和编辑此解决方案!

1
以下内容解决了我的问题:
brew remove imagemagick
brew install imagemagick --disable-openmp --build-from-source

cd /usr/local/Cellar/imagemagick/6.8.8-9/lib
ln -s libMagick++-6.Q16.3.dylib libMagick++.dylib
ln -s libMagickCore-6.Q16.2.dylib libMagickCore.dylib
ln -s libMagickWand-6.Q16.2.dylib libMagickWand.dylib

gem install rmagick  -v '2.12.2'

来源:http://winstonyw.com/2013/03/21/installing-imagemagick-and-rmagick/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接