在 Mac OS X 上安装 Rmagick 时出错

发布于 2024-10-04 11:49:43 字数 1248 浏览 5 评论 0 原文

我按照 RMagick 安装了 OSX: http://rmagick.rubyforge.org/install-faq.html#osx

我已经从 John Maddux 完成了 Imagemagick 安装(将 ImageMagick 安装在OSX 不使用 MacPorts

这是我的终端窗口:

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$ 

非常感谢您的帮助, 苏帕特

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

I have done the Imagemagick installation from John Maddux (solution to install ImageMagick on OSX without using MacPorts)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

标点 2024-10-11 11:49:43

我强烈建议你尝试 homebrew,它是 macports 的一个很好的替代品:

一旦你安装了 homebrew,你应该能够安装 imagemagick 并rmagick 非常容易:

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

更多信息在这里:

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

和此处:

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/

更新:(感谢 JJD这个答案

如果您在安装 chiliproject 时遇到问题,请尝试在没有 openpmp 的情况下安装:

brew install imagemagick --disable-openmp

更新 X2:(感谢 Ramon Araujo评论

如果您之前安装过imagemagick使用自制程序,您必须在再次安装之前取消链接:

brew unlink imagemagick

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

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

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

More info here:

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/

UPDATE: (thanks to JJD and this answer)

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

brew install imagemagick --disable-openmp

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

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

brew unlink imagemagick
深居我梦 2024-10-11 11:49:43

另一个需要注意的是 imagemagick 的版本。
我有 ImageMagick 版本 6.8.0,如果您从自制软件安装,这是最新的版本,而 rmagick 无法使用该版本进行编译。
所以做一个

转换--版本

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

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

convert --version

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

凉栀 2024-10-11 11:49:43

与这个问题斗争了一段时间,下面的修复(复制自这个SO答案解决了这个问题(特别是关于 您

rmagick 在使用 homebrew 的 imagemagick (>= 6.8.0-10) 时出现问题。

可以

通过更新 rmagick gem

bundle update rmagick

或手动符号链接一些 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

之后 gem install rmagick 可以工作。

应该 /homebrew/issues/16625

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

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

You can either

update rmagick gem by

bundle update rmagick

or manually symbol link some dylib to make it work:

$ 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 rmagick should work.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文