在Mountain Lion上安装Rmagick时出错

时间:2012-12-18 22:19:22

标签: imagemagick rvm bundler osx-mountain-lion rmagick

我见过其他人有同样问题installing RMagick on Mountain Lion但是没有一个建议的解决方案允许我成功安装rmagick。

以下是我收到的错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
checking for Ruby version >= 1.8.5... yes
checking for /usr/local/bin/gcc-4.2... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
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.

*** 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.

我做过的事情:

Installed XCode
Installed the command line tools
Installed XQuartz
Installed homebrew with imagemagick library
Installed most recent version of RVM
Symlinked GCC
Uninstalled and reinstalled both RVM and imagemagick

任何想法为什么我仍然无法下载rmagick?

8 个答案:

答案 0 :(得分:216)

似乎在Homebrew github repo(https://github.com/mxcl/homebrew/issues/16625)上报告的问题归咎于rmagick本身不支持更新版本的imagemagick。在同一个问题(https://github.com/mxcl/homebrew/issues/16625#issuecomment-11519383)上,您可以找到以下链接:https://coderwall.com/p/wnomjg这对我有用。这就是他的所作所为:

cd /usr/local/Cellar/imagemagick/6.8.0-10/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

希望这有帮助。

答案 1 :(得分:31)

答案 2 :(得分:8)

我们做了以下事情:

cd /usr/local
git checkout 834ce4a Library/Formula/imagemagick.rb
brew install imagemagick

这将安装Imagemagick 6.7.7-6

答案 3 :(得分:5)

我知道这是旧的,但我已经通过了一堆这些回复,仍然无法让它发挥作用。我发现另一种语言的随机链接实际上解决了我的问题(http://sugiarto.webmuapp.com/Package_MagickCore_was_not_found_in_the_pkg_config_search_path)。看起来它正在寻找没有设置的PKG_CONFIG_PATH。

对我有用的是什么:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

然后确保它有效:

find /usr -name 'MagickCore.pc'
/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/MagickCore.pc
/usr/local/lib/pkgconfig/MagickCore.pc

然后再次尝试安装rmagick:

gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
Installing ri documentation for rmagick-2.13.2...
Installing RDoc documentation for rmagick-2.13.2...

成功!希望这有助于其他人继续遇到这个问题。

答案 4 :(得分:2)

来自其他答案:

PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick gem install rmagick -v '2.13.1'

请参阅https://stackoverflow.com/a/10645011/1197775了解如何获取这些目的。

答案 5 :(得分:2)

以下是macOS Sierra的功能。

brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config
brew link pkg-config

答案 6 :(得分:1)

我知道这是一个相当古老的问题但最近确实发生在我身上。我发布这个已经尝试过所有其他答案并且到目前为止无法解决的人。将rmagick gem压缩到版本2.13.4已经在MacOS上使用了Ruby 1.9.3

希望它有所帮助!

答案 7 :(得分:0)

检查我对openssl问题https://stackoverflow.com/a/13958931/497756的回答 - 只需确保编译了包含*.pc文件的imagemagick - 这是大多数软件的默认设置,但不是全部。