【问题标题】:Can't install RMagick on OS X Mountain Lion无法在 OS X Mountain Lion 上安装 RMagick
【发布时间】:2012-10-21 14:00:27
【问题描述】:

我已经为此苦苦挣扎了一段时间。我正在运行 Mac OS 10.7 (Mountain Lion),并且正在尝试安装 RMagick gem,以便可以在我的 Rails 3 应用程序中使用它。我已经用自制软件安装了 imagemagick,这似乎成功完成了。我还安装了 XQuartz 包。当我将“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

知道为什么会这样吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 imagemagick osx-mountain-lion rmagick


    【解决方案1】:

    按照以下步骤修复它。啊!

    1. 安装 XCode 4.4
    2. 安装命令行工具(通过 Xcode 中的首选项)
    3. 安装 XQuartz
    4. 安装 ImageMagic (brew install —vd imagemagick)
    5. sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
    6. mdfind MagickWand.h(获取 MagickWand.h 文件的路径)
    7. C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick

    【讨论】:

    • 我还需要在安装 rmagick gem 之前告诉 RVM 我正在​​使用全局 gemset。我第一次安装时,它安装到了错误的 gemset 中,并且应用程序没有看到它
    猜你喜欢
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 2012-12-06
    • 1970-01-01
    • 2013-06-17
    • 1970-01-01
    相关资源
    最近更新 更多