Ruby-on-rails Bundle 无法在 Mac OSX 10.7 上安装 RMagick gem

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10063051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 03:11:42  来源:igfitidea点击:

Bundle can't install RMagick gem on Mac OSX 10.7

ruby-on-railsrubyrvmrmagick

提问by PabloJimeno

I've installed ImageMagick with ImageMagick installer script https://github.com/maddox/magick-installer. I am on OSX Lion 10.7, using RVM, Ruby 1.9.3p125.

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

The problem seems to be with MagickWand.h here is the complete log

问题似乎出在 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

采纳答案by Ekampp

I suggest that you use brewto manage your binary dependencies. You can easily install imageMagick with brew, like this:

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

brew install imagemagick

This is what I have on my system:

这是我的系统上的内容:

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

And I have the same setup as you have in terms of machine and ruby-version.

在机器和 ruby​​ 版本方面,我的设置与您相同。

回答by xonico

fix this setting the include path of your current imagemagick installation:

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

Install ImageMagick with brew

使用 brew 安装 ImageMagick

brew install imagemagick

find library

找图书馆

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

Install rmagick gem

安装 rmagick gem

$ C_INCLUDE_PATH=/path gem install rmagick

example:

例子:

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

回答by Gerry Eng

If you're getting Package xxxwas not found.

如果您收到xxx未找到包。

Find the package and add it's dir path to the PKG_CONFIG_PATHvariable in your ~/.bash_loginor ~/.bash_profilefile.

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

Example:

例子:

If you get the error:

如果您收到错误:

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

Find where the file is:

查找文件所在位置:

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

Add to your bash_login or bash_profile:

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

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

remember to source the bash_login/profile file

记得获取 bash_login/profile 文件的来源

回答by Keegan Brown

At the time of writing this, imagemagick 7 is the default version installed via brew install imagemagick, but is incompatible with rmagick. Fix this by:

在撰写本文时,imagemagick 7 是通过 安装的默认版本brew install imagemagick,但与rmagick. 通过以下方式解决此问题:

  1. Remove currently installed version of imagemagick with homebrew
  1. 使用自制软件删除当前安装的 imagemagick 版本

brew uninstall imagemagick

brew uninstall imagemagick

  1. Install imagemagick 6:
  1. 安装 imagemagick 6:

brew install imagemagick@6

brew install imagemagick@6

  1. Run gem install with pkgconfig variable (may have to sudodepending on your config)
  1. 使用 pkgconfig 变量运行 gem install (可能必须sudo取决于您的配置)

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

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

回答by CodeGroover

Also found a solution using homebrew:

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

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

and then

进而

gem install rmagick

回答by Andrey Yasinishyn

1) install by installer

1)由安装程序安装

http://cactuslab.com/imagemagick/

http://cactuslab.com/imagemagick/

2) try gem install rmagick

2) 尝试 gem install rmagick

if checking for wand/MagickWand.h... no
type

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

mdfind MagickWand.h

find some thing like

找到类似的东西

/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h

and type in terminal

并输入终端

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

if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."

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

type

类型

mdfind MagickCore.pc

find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

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

and finally in terminal type:

最后在终端类型:

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

回答by Ahmad Hussain

Andrey Yasinishyn's solution worked for me:

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

mdfind MagickCore.pc

find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

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

and finally in terminal type:

最后在终端类型:

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

回答by Pragmatiq

I tried everything, but what ended up being the solution was:

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

brew uninstall --force imagemagick# removes all versions

brew uninstall --force imagemagick# 删除所有版本

then

然后

brew install imagemagick@6

brew install imagemagick@6

finally

最后

gem install rmagick

gem install rmagick

回答by Dan Higham

When I came up against this issue, it was complaining it couldn't find MagickCore.pc, so I did this;

当我遇到这个问题时,它抱怨找不到 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

and it worked!

它奏效了!

回答by Hunter

For what it is worth I had this problem with Ruby ree-1.8.7-2012-02. Here's how I fixed it:

值得一提的是,我在 Ruby ree-1.8.7-2012-02 上遇到了这个问题。这是我修复它的方法:

I removed ImageMagick and re-installed it

我删除了 ImageMagick 并重新安装了它

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

I then added these symbolic links in /usr/local/Cellar/imagemagick/6.8.9-7/lib/

然后我在 /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

I then removed the Ruby version and re-installed it

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

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

Finally installed the Gem

终于安装了 Gem

gem install rmagick -v '2.12.2'

Hope this helps.

希望这可以帮助。