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

Pab*_*eno 23 ruby ruby-on-rails rmagick rvm

我已经使用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
Run Code Online (Sandbox Code Playgroud)

小智 39

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

用brew安装ImageMagick

brew install imagemagick
Run Code Online (Sandbox Code Playgroud)

找到图书馆

$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h
Run Code Online (Sandbox Code Playgroud)

安装rmagick gem

$ C_INCLUDE_PATH=/path gem install rmagick
Run Code Online (Sandbox Code Playgroud)

例:

$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick
Run Code Online (Sandbox Code Playgroud)

  • 它可以在任何情况下以任何方式工作,但运行`find/usr/local/Cellar -name MagickCore.pc`并设置`PKG_CONFIG_PATH`环境变量为我解决了它. (2认同)

Ger*_*Eng 27

如果你xxx没有找到包裹.

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

例:

如果您收到错误:

Package MagickCore was not found in the pkg-config search path.
Run Code Online (Sandbox Code Playgroud)

找到文件的位置:

$ mdfind magickcore.pc
/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/MagickCore.pc
Run Code Online (Sandbox Code Playgroud)

添加到您的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文件

  • 对我来说唯一有用的东西,尝试了以上所有.但只有`PKG_CONFIG_PATH =/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/gem install rmagick`才能搞定. (7认同)
  • 使用`sudo C_INCLUDE_PATH =/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/PKG_CONFIG_PATH =/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/gem install rmagick` I能够完成rmagick安装.然而,还有其他问题,取消链接和重新安装imagemagick最终是必要的.Ruby*比Node.js等更成熟,但在不同版本的Ruby和Gems之间切换仍然不是直截了当的. (3认同)

Eka*_*mpp 24

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

brew install imagemagick
Run Code Online (Sandbox Code Playgroud)

这就是我在我的系统上的内容:

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
Run Code Online (Sandbox Code Playgroud)

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


Cod*_*ver 15

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

brew remove --force pkg-config
brew install pkg-config
Run Code Online (Sandbox Code Playgroud)

然后

gem install rmagick
Run Code Online (Sandbox Code Playgroud)


Kee*_*own 15

在撰写本文时,imagemagick 7是通过安装的默认版本brew install imagemagick,但与之不兼容rmagick.解决这个问题:

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

brew uninstall imagemagick

  1. 安装imagemagick 6:

brew install imagemagick@6

  1. 使用pkgconfig变量运行gem install(可能必须sudo依赖于您的配置)

PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick


And*_*hyn 8

1)由安装人员安装

http://cactuslab.com/imagemagick/

2)尝试gem install rmagick

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

mdfind MagickWand.h
Run Code Online (Sandbox Code Playgroud)

找到一些像

/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h
Run Code Online (Sandbox Code Playgroud)

并输入终端

C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick
Run Code Online (Sandbox Code Playgroud)

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

类型

mdfind MagickCore.pc
Run Code Online (Sandbox Code Playgroud)

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

最后是终端类型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Run Code Online (Sandbox Code Playgroud)


Ahm*_*ain 5

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

mdfind MagickCore.pc
Run Code Online (Sandbox Code Playgroud)

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

最后是终端类型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Run Code Online (Sandbox Code Playgroud)