Gem 自从卸载了 rmagick 以后就 install 不回去了...不得已来求助~

lingxueyu · 2016年01月08日 · 最后由 lingxueyu 回复于 2016年01月12日 · 4072 次阅读

OS X EI Capitan 10.11.1。。曾经我在执行了 brew update && brew upgrade 以后我的 rails c 什么的就跑不起来了。。报了个 image 的错误,然后我就脑抽得卸载了 rmagick,bundle exec gem uninstall rmagick,并且选择了 all versions..然后就是用尽浑身解数也装不回去了。。执行 sudo gem install rmagick 一直提示 ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /Users/apple/.rbenv/versions/2.2.0-dev/bin/ruby -r ./siteconf20160108-2705-15xzewu.rb extconf.rb checking for clang... yes checking for Magick-config... yes checking for outdated ImageMagick version (<= 6.4.9)... no checking for Ruby version >= 1.8.5... 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/apple/.rbenv/versions/2.2.0-dev/bin/$(RUBY_BASE_NAME) /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:457:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:588:intry_cpp' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:1091:in block in have_header' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:942:inblock in checking_for' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:351:in block (2 levels) in postpone' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:321:inopen' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:351:in block in postpone' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:321:inopen' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:347:in postpone' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:941:inchecking_for' from /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/2.3.0/mkmf.rb:1090:in have_header' from extconf.rb:38:inconfigure_headers' from extconf.rb:18:in initialize' from extconf.rb:517:innew' from extconf.rb:517:in `

'

extconf failed, exit code 1

Gem files will remain installed in /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.3.0/gems/rmagick-2.15.4 for inspection. Results logged to /Users/apple/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0-static/rmagick-2.15.4/gem_make.out

我重装了 brew install imagemagick,还是不能 sudo gem install rmagick 查了很多,居然大多都是在 window 上装才会出现这种错误信息。。可是我 OS X 诶。。于是就蛋疼了。。

这个到底是为毛啊。。。跪求!

我也怀疑我是不是搞了点 npm 的东西。。结果把这个 navite 搞坏了。。但是想想又不大可能吧。。

checking for outdated ImageMagick version (<= 6.4.9)... no

你的 ImageMagick 版本是啥?

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.

检查 mkmf.log

Let me google that for you

You are not alone.

http://stackoverflow.com/questions/13963404/rails-and-os-x-how-to-install-rmagick

#1 楼 @fighterleslie imagemagick-6.9.2-10 /(ㄒo ㄒ)/~~道友你也有过咩?

啊啊啊啊我装起来了~~~~ 用了http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_xnokogiri里面的一个解决方法~~然后我的rmagick也install成功了!!这里面对于 brew unlink gcc gem uninstall nokogiri xcode-select --install gem install nokogiri gem install rmagick

checking for stdint.h... *** extconf.rb failed ***

我觉得你还是自己 cd 进目录跑一下编译看看到底是哪步崩了。 目测和 1 楼的链接说的还不太一样。

#4 楼 @msg7086 我解决了 O(∩_∩)O 谢谢

#5 楼 @lingxueyu 解决了也记得更新下帖子哈,为后来人提供参考

#6 楼 @martin91 我已经解决了~我楼上有贴答案啊~

需要 登录 后方可回复, 如果你还没有账号请 注册新账号