简体   繁体   English

无法在OS X Mountain Lion上安装RMagick

[英]Can't install RMagick on OS X Mountain Lion

I've been struggling with this for a while. 我一直在努力解决这个问题。 I'm running Mac OS 10.7 (Mountain Lion), and I'm trying to install the RMagick gem so I can use it in my Rails 3 app. 我正在运行Mac OS 10.7(Mountain Lion),我正在尝试安装RMagick gem,以便我可以在我的Rails 3应用程序中使用它。 I already installed imagemagick with homebrew, and that seemed to finish successfully. 我已经用homebrew安装了imagemagick,这似乎成功完成了。 I also installed the XQuartz package. 我还安装了XQuartz包。 When I add 'rmagick' to my gemfile and run bundle install, I get this error: 当我将'rmagick'添加到我的gemfile并运行bundle install时,我收到此错误:

Installing rmagick (2.13.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/Andrew/.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 clang... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /Users/Andrew/.rvm/rubies/ruby-1.9.3-p125/bin:/Users/Andrew/.rvm/gems/ruby-1.9.3-p125@global/bin:/Users/Andrew/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin

*** 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/Andrew/.rvm/rubies/ruby-1.9.3-p125/bin/ruby


Gem files will remain installed in /Users/Andrew/.rvm/gems/ruby-1.9.3-p125@global/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/Andrew/.rvm/gems/ruby-1.9.3-p125@global/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.

Process finished with exit code 5

Any idea why this is happening? 知道为什么会这样吗?

Fixed it by following these steps. 通过以下步骤修复它。 Arrggh! Arrggh!

  1. Install XCode 4.4 安装XCode 4.4
  2. Install command line tools (from the preferences in Xcode) 安装命令行工具(来自Xcode中的首选项)
  3. Install XQuartz 安装XQuartz
  4. Install ImageMagic (brew install —vd imagemagick) 安装ImageMagic(brew install -vd imagemagick)
  5. sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
  6. mdfind MagickWand.h (to get the path to the MagickWand.h file) mdfind MagickWand.h(获取MagickWand.h文件的路径)
  7. C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick C_INCLUDE_PATH = / usr / local / Cellar / imagemagick / 6.7.7-6 / include / ImageMagick gem install rmagick

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

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