简体   繁体   English

无法在Mountain Lion上安装rmagick gem

[英]Can't install rmagick gem on Mountain Lion

Note: my situation is almost identical to this: Can't install pg gem on Mountain Lion . 注意:我的情况几乎与此相同: 无法在Mountain Lion上安装pg gem

I just upgraded from Snow Leopard to Mountain Lion and Rails is giving me all kinds of problems, especially trying to install the 'rmagick' gem. 我刚从Snow Leopard升级到Mountain Lion,Rails给了我各种各样的问题,特别是试图安装'rmagick'宝石。 I'm running Ruby 1.9.3-p362 and Rails 3.2.11. 我正在运行Ruby 1.9.3-p362和Rails 3.2.11。

➜  git:(master) ✗ sudo gem install rmagick -v 2.13.1
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
         /opt/local/bin/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
         /OPT/LOCAL/BIN/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
         /USR/LOCAL/BIN/Magick-config reports version 6.8.0 Q16 is installed in /USR/LOCAL/Cellar/imagemagick/6.8.0-10
Using 6.6.6 Q8 from /opt/local.

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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
    --without-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/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
    from extconf.rb:193:in `<main>'


Gem files will remain installed in /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

➜  applyco git:(master) ✗ brew install imagemagick --disable-openmp
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: imagemagick-6.8.0-10 already installed

➜  applyco git:(master) ✗ apt-get install libmagick9-dev
zsh: command not found: apt-get

I have tried: 我试过了:

  • Installing Xcode with command line tools 使用命令行工具安装Xcode
  • Reinstalling homebrew 重新安装自制软件
  • Clearing out all my repo's gems (including Gemfile.lock) and running bundle install 清除所有repo的宝石(包括Gemfile.lock)并运行bundle install
  • Reinstalling the bundler gem 重新安装bundler gem
  • Reinstalling ImageMagick 重新安装ImageMagick

Nothing, including answers elsewhere on SO, have been of any use. 没有任何东西,包括SO上其他地方的答案,都没有任何用处。 Can you point me in the right direction? 你能为我指出正确的方向吗?

I had the same problem as you setting up my dev environment on Mountain Lion for RoR 3.2.11. 我在山狮为RoR 3.2.11设置我的开发环境时遇到了同样的问题。 Apparently the last version of RMagick (2.13.1 ) doesn't play nice compiling with the last version of ImageMagick (6.8.2-0). 显然,RMagick(2.13.1)的最后一个版本与最新版本的ImageMagick(6.8.2-0)不能很好地编译。 Disabling openmp and building from source worked like, ahem.. Magick. 禁用openmp并从源代码构建工作就像,咳嗽...... Magick。

brew uninstall imagemagick
brew install imagemagick --disable-openmp --build-from-source
gem install rmagick

I didn't need to edit the brew formula described in http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/ , but that would be the next step to try. 我不需要编辑http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/中描述的brew公式,但是这将是下一步尝试。

I am going through the same issue here... But one difference, maybe your homebrew its linked to another version of Imagemagick. 我在这里遇到同样的问题......但是有一点不同,也许你的自制软件与另一个版本的Imagemagick相关联。

So even though imagemagick-6.8.0-10 is installed is not being found. 所以即使没有找到imagemagick-6.8.0-10。

Try something like brew unlink imagemagick then brew link imagemagick and see what happens. 尝试一下像brew unlink imagemagick然后brew link imagemagick ,看看会发生什么。

This fixed my problem http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion 这解决了我的问题http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion

It may be a permissions issue try running 尝试运行可能是权限问题

sudo chown -R `whoami` /usr/local

and then try again. 然后再试一次。

I had the same issue while trying to use Paperclip with Rails 3 for the first time. 我第一次尝试使用Paperclip和Rails 3时遇到了同样的问题。 Just to sum up previous answers, what worked for me was the following: 总结以前的答案,对我有用的是:

sudo chown -R `whoami` /usr/local
brew link --overwrite imagemagick

Thanks! 谢谢!

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

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