Bundle无法在Mac OSX 10.7上安装RMagick gem
我已经使用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
我建议您使用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版本方面拥有相同的设置。
修复此设置当前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
如果您收到包xxx
未找到。
找到包并将它的dir路径添加到~/.bash_login
或~/.bash_profile
文件中的PKG_CONFIG_PATH
变量。
例:
如果您收到错误:
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文件
还找到了使用自制软件的解决方案:
brew remove --force pkg-config brew install pkg-config
然后
gem install rmagick
在撰写本文时,imagemagick 7是通过brew install imagemagick
安装的默认版本,但与rmagick
不兼容。 解决这个问题:
- 使用自制软件删除当前安装的imagemagick版本
brew uninstall imagemagick
- 安装imagemagick 6:
brew install imagemagick@6
- 使用pkgconfig变量运行gem install(可能需要
sudo
具体取决于您的配置)
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick
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
Andrey Yasinishyn的解决方案对我有用:
mdfind MagickCore.pc
找到像/opt/ImageMagick/lib/pkgconfig/MagickCore.pc这样的东西
最后是终端类型:
PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
当我遇到这个问题时,它抱怨它找不到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
它工作了!
我必须添加两个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
值得一提的是我在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'
希望这可以帮助。
对于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
我尝试了一切,但最终成为解决方案的是:
brew uninstall --force imagemagick
#删除所有版本
然后
brew install imagemagick@6
最后
gem install rmagick