Bundle无法在Mac OSX 10.7上安装RMagick gem

时间:2012-04-08 13:09:59

标签: ruby-on-rails ruby rvm rmagick

我已经使用ImageMagick安装程序脚本https://github.com/maddox/magick-installer安装了ImageMagick。我在OSX Lion 10.7上,使用RVM,Ruby 1.9.3p125。

问题似乎是MagickWand.h这里是完整的日志

/Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc... 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.1. 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.

Provided configuration options:
    --with-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=/Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby

12 个答案:

答案 0 :(得分:39)

修复此设置当前imagemagick安装的包含路径:

使用brew安装ImageMagick

brew install imagemagick

找到图书馆

$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h

安装rmagick gem

$ C_INCLUDE_PATH=/path gem install rmagick

示例:

$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick

答案 1 :(得分:26)

如果您收到包裹xxx,则无法找到。

找到包并将其dir路径添加到PKG_CONFIG_PATH~/.bash_login文件中的~/.bash_profile变量。

示例:

如果收到错误:

Package MagickCore was not found in the pkg-config search path.

查找文件的位置:

$ mdfind magickcore.pc
/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/MagickCore.pc

添加到您的bash_login或bash_profile:

export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/:$PKG_CONFIG_PATH"

记得来源bash_login / profile文件

答案 2 :(得分:24)

我建议您使用brew来管理二进制依赖项。您可以使用brew轻松安装imageMagick,如下所示:

brew install imagemagick

这就是我在我的系统上所拥有的:

imagemagick 6.7.1-1
http://www.imagemagick.org
Depends on: jpeg, libtiff, little-cms, jasper
/usr/local/Cellar/imagemagick/6.7.1-1 (1389 files, 32M)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/imagemagick.rb

我在机器和ruby版本方面拥有相同的设置。

答案 3 :(得分:15)

还使用自制软件找到了解决方案:

brew remove --force pkg-config
brew install pkg-config

然后

gem install rmagick

答案 4 :(得分:12)

在撰写本文时,imagemagick 7是通过brew install imagemagick安装的默认版本,但与rmagick不兼容。修复此问题:

  1. 使用自制软件
  2. 删除当前安装的imagemagick版本

    brew uninstall imagemagick

    1. 安装imagemagick 6:
    2. brew install imagemagick@6

      1. 使用pkgconfig变量运行gem install(可能需要sudo,具体取决于您的配置)
      2. PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick

答案 5 :(得分:8)

1)由安装人员安装

http://cactuslab.com/imagemagick/

2)尝试gem install rmagick

如果检查魔杖/ MagickWand.h ......没有 型

mdfind MagickWand.h
找到像

这样的东西
/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h

并输入终端

C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick

如果之后你有这个错误(因为有了它)“在pkg-config搜索路径中找不到包MagickCore。”

mdfind MagickCore.pc
找到像/opt/ImageMagick/lib/pkgconfig/MagickCore.pc这样的东西

最后是终端类型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick

答案 6 :(得分:5)

Andrey Yasinishyn的解决方案对我有用:

mdfind MagickCore.pc
找到像/opt/ImageMagick/lib/pkgconfig/MagickCore.pc这样的东西

最后是终端类型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick

答案 7 :(得分:3)

当我遇到这个问题时,它抱怨它找不到MagickCore.pc,所以我这样做了;

$ mdfind MagickCore.h
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/magick/MagickCore.h
/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/MagickCore.h

$ export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/
$ gem install rmagick

它有效!

答案 8 :(得分:1)

我必须添加两个env变量才能使其工作。像这样的东西

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick 

答案 9 :(得分:1)

对于值得的东西,我在Ruby ree-1.8.7-2012-02中遇到了这个问题。以下是我修复它的方法:

我删除了ImageMagick并重新安装了

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

然后我在/usr/local/Cellar/imagemagick/6.8.9-7/lib /

中添加了这些符号链接
ln -s libMagick++-6.Q16.5.dylib libMagick++.dylib
ln -s libMagickCore-6.Q16.2.dylib libMagickCore.dylib
ln -s libMagickWand-6.Q16.2.dylib libMagickWand.dylib

然后我删除了Ruby版本并重新安装

rvm remove ree-1.8.7-2012-02
rvm install ree-1.8.7-2012-02

最后安装了Gem

gem install rmagick -v '2.12.2'

希望这有帮助。

答案 10 :(得分:1)

对于El Capitan用户,

需要包含PKG_CONFIG_FILE和C_INCLUDE_PATH。对我有用的命令是:

sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/lib/pkgconfig/ gem install rmagick

答案 11 :(得分:1)

我尝试了一切,但最终成为解决方案的是:

https://$USERNAME:$APIKEY@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package_Server/getAllObjects #删除所有版本

然后

brew uninstall --force imagemagick

最后

brew install imagemagick@6

相关问题