在Mac 10.9上安装rmagick gem遇到问题

3

我尝试了所有在SO和git上找到的解决方案,但都没有成功。我正在尝试在新的mbp retina w/ mavericks上运行现有项目上的bundle install。以下是我的跟踪记录:

Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/***/.rvm/rubies/ruby-1.9.3-p448/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... 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... no

Can't install RMagick 2.13.2. Can't find MagickWand.h.
*** 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.

brew doctor的输出结果

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /usr/local/bin/gpg-error-config
    /usr/local/bin/ksba-config
    /usr/local/bin/pkg-config

Warning: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!

Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /usr/local/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

你是否使用Homebrew进行软件包管理?如果不是,你使用的是什么? - Peter Goldstein
是的,我是。抱歉我应该提到这一点。 - bonum_cete
你可能想在这里查看 - http://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install。虽然该答案是关于CentOS的,但关键问题是MagickCore.pc文件在哪里。检查'ls /usr/local/lib/pkgconfig/MagickCore.pc',如果不存在,请执行'find / -name MagickCore.pc'以获取路径。 - Peter Goldstein
1
你能运行 'brew doctor' 命令,看看你的imagemagick链接是否正确吗?似乎你缺少一个符号链接。在我的系统上,我有 /usr/local/lib/pkgconfig/MagickCore.pc -> ../../Cellar/imagemagick/6.8.7-0/lib/pkgconfig/MagickCore.pc。 - Peter Goldstein
这可能是我会做的事情。你看过这个Gist吗 - https://gist.github.com/mxcl/1173223? - Peter Goldstein
显示剩余8条评论
1个回答

5

我和@isea在聊天中讨论了这个问题。关键问题如下:

  1. Homebrew安装在非标准目录中。一般来说,这是很危险的。
  2. 一旦重新安装了Homebrew,就需要使用“brew install pkg-config”安装pkg-config软件包。

这样问题就解决了。


这是我见过的最简单直接的解释,你的建议非常有效。谢谢! - Kent Rancourt

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