简体   繁体   English

如何在Mac OS X Mountain Lion上安装rmagick?

[英]How to install rmagick on Mac OS X Mountain Lion?

I'm trying to install rmagick on Mountain Lion. 我正在尝试在Mountain Lion上安装rmagick。
I've installed ImageMagick successfully by Homebrew, but I can't install rmagick gem. 我已经通过Homebrew成功安装了ImageMagick,但是无法安装rmagick gem。 My ruby environment is managed by rvm and installed ruby 1.8.6. 我的ruby环境由rv​​m管理,并安装了ruby 1.8.6。

I've got an error below when tried to install rmagick. 尝试安装rmagick时,出现以下错误。

gem install rmagick -v 2.7.2
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
     ERROR: Failed to build gem native extension.

/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for magick/MagickCore.h... no
Can't install RMagick 2.7.2. Can't find MagickCore.h.

The erros shows that counldn't find MagickCore.h, but I found in /usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h 该错误表明无法找到MagickCore.h,但我在/usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h中找到了
I guess if I can manage to tell installer this path, it will go well but I've no idea to do it. 我想如果我能告诉安装程序这条路径,它将很好,但是我不知道要这样做。

I've googled and found similar questions below. 我已经在Google上搜索,并在下面找到了类似的问题。
Can't install rmagick in Mountain Lion 无法在Mountain Lion中安装rmagick
"rmagick" gem installation issue “ rmagick” gem安装问题
And tried to pass PKG_CONFIG_PATH and C_INCLUDE_PATH before 'gem install' command, and wrote them to ~/.bash_profie, and build ImageMagick from source, but nothing changed. 并尝试在“ gem install”命令之前传递PKG_CONFIG_PATH和C_INCLUDE_PATH,并将它们写入〜/ .bash_profie,并从源代码构建ImageMagick,但没有任何改变。

Does anyone know how to fix it? 有谁知道如何修理它?

Here you'll find the answer. 在这里,您将找到答案。 I had the same issue and this solved perfectly! 我有同样的问题,这完美解决了!

Rails and OS X: How to install rmagick? Rails和OS X:如何安装rmagick?

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 rmagick should work. gem install rmagick之后, gem install rmagick应该可以工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM