macos 在 Mac OS X 上安装 Rmagick 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4290759/
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-10-21 07:22:56  来源:igfitidea点击:

Error installing Rmagick on Mac OS X

macosruby-on-rails-3imagemagickrmagick

提问by howdy

I followed the installation of RMagickfor OSX:http://rmagick.rubyforge.org/install-faq.html#osx

我跟着安装RMagickOSX:http://rmagick.rubyforge.org/install-faq.html#osx

I have done the Imagemagickinstallation from John Maddux(solution to install ImageMagickon OSX without using MacPorts)

我已经完成了John MadduxImagemagick安装(在不使用MacPorts 的情况下在 OSX上安装ImageMagick 的解决方案)

Here's my terminal window:

这是我的终端窗口:

Suebphatt:~ suebphattleelertphong$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

Suebphatt:~ suebphattleelertphong$ rails -v
Rails 3.0.3

Suebphatt:~ suebphattleelertphong$ gem -v
1.3.7

Suebphatt:~ suebphattleelertphong$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1 for     inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Suebphatt:~ suebphattleelertphong$ 

Thanks a lot for help, Suebphatt

非常感谢您的帮助,Suebphat

回答by bowsersenior

I would strongly recommend you try homebrew, which is a great replacement for macports:

我强烈建议您尝试自制软件,它是 macports 的绝佳替代品:

Once you get homebrew installed, you should be able to install imagemagick and rmagick very easily:

安装自制软件后,您应该能够非常轻松地安装 imagemagick 和 rmagick:

brew install imagemagick     # will take a while!
gem install rmagick

More info here:

更多信息在这里:

http://www.codedrop.ca/blog/archives/214

http://www.codedrop.ca/blog/archives/214

and here:

和这里:

http://weblogs.manas.com.ar/mverzilli/2010/05/19/install-the-rmagick-gem-in-the-painless-way-with-homebrewinstall-the-rmagick-gem-in-the-painless-way-with-homebrewinstall-the-rmagick-gem-in-the-painless-way-with-homebrewinstall-the-rmagick-gem-in/

http://weblogs.manas.com.ar/mverzilli/2010/05/19/install-the-rmagick-gem-in-the-painless-way-with-homebrewinstall-the-rmagick-gem-in-the- painless-way-with-homebrewinstall-the-rmagick-gem-in-the-painless-way-with-homebrewinstall-the-rmagick-gem-in/

UPDATE: (thanks to JJDand this answer)

更新:(感谢JJD这个答案

Try to install without openpmp if you are having trouble with a chiliproject install:

如果您在安装辣椒项目时遇到问题,请尝试在不使用 openpmp 的情况下进行安装:

brew install imagemagick --disable-openmp

UPDATE X2: (thanks to Ramon Araujo's comment)

更新 X2:(感谢Ramon Araujo评论

If you have previously installed imagemagick with homebrew, you will have to unlink it before you install again:

如果您之前已经使用自制软件安装了 imagemagick,则必须在再次安装之前取消链接:

brew unlink imagemagick

回答by Arthur Neves

Another think to watch out is the version of imagemagick. I had ImageMagick version 6.8.0, which is the latest if you install from homebrew, and rmagick just does not compile with this version. So do a

另一个需要注意的是 imagemagick 的版本。我有 ImageMagick 版本 6.8.0,如果你从自制软件安装,这是最新的,而 rmagick 只是不能用这个版本编译。所以做一个

convert --version

转换 --version

and make sure that your ImageMagick is 6.7 or less otherwise rmagick wont compile..

并确保您的 ImageMagick 为 6.7 或更低,否则 rmagick 将无法编译..

回答by Phil

Struggled with this problem for a while, and the fix below (copied from this SO answersolved the issue (specifically the section about symbolic links).

为这个问题苦苦挣扎了一段时间,下面的修复(从这个 SO 答案复制解决了这个问题(特别是关于符号链接的部分)。

rmagick has a problem working with imagemagick (>= 6.8.0-10) from homebrew.

rmagick 在使用自制软件的 imagemagick (>= 6.8.0-10) 时遇到问题。

You can either

你可以

update rmagick gem by

更新 rmagick gem

bundle update rmagick

or manually symbol link some dylib to make it work:

或手动符号链接一些 dylib 以使其工作:

$ cd "`Magick-config --prefix`lib"
$ ln -s libMagick++-Q16.7.dylib   libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib

After that gem install rmagickshould work.

在那之后gem install rmagick应该工作。

Check the discussion about this in https://github.com/Homebrew/homebrew/issues/16625

https://github.com/Homebrew/homebrew/issues/16625 中查看关于此的讨论