Ruby on rails 无法在OS X 10.10 Yosemite上安装RMagic和Nokogiri
必须安装约塞米蒂以解决Wi-Fi问题,但现在安装rmagick失败。我尝试了StackOverflow和Github上的每一篇文章,但安装仍然失败 我使用的是通过rbenv安装的ruby 2.1.1p76 2014-02-24修订版45161[x86_64-darwin13.0] 但失败了:Ruby on rails 无法在OS X 10.10 Yosemite上安装RMagic和Nokogiri,ruby-on-rails,macos,nokogiri,rmagick,osx-yosemite,Ruby On Rails,Macos,Nokogiri,Rmagick,Osx Yosemite,必须安装约塞米蒂以解决Wi-Fi问题,但现在安装rmagick失败。我尝试了StackOverflow和Github上的每一篇文章,但安装仍然失败 我使用的是通过rbenv安装的ruby 2.1.1p76 2014-02-24修订版45161[x86_64-darwin13.0] 但失败了: Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Fa
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/pain/.rbenv/versions/2.1.1/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes
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/pain/.rbenv/versions/2.1.1/bin/ruby
/Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
from extconf.rb:194:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/pain/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/pain/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/rmagick-2.13.2/gem_make.out
任何建议都会很有帮助。谢谢
在运行gem cleanup之后,我意识到无论我做什么,我都不能安装nokogiri…我只是在OSX 10.10上遇到了同样的问题,并且完成了您所经历的大部分步骤。如果使用CC=clang前缀安装ruby,请导航到/usr/bin并运行:
如果您仍然遇到问题,我可能会在删除GCC4.2并重建Ruby之后尝试sudo ln-s clanggcc-4.2。这修复了rmagick和nokogiri的所有问题。谢谢,但使用clang并没有改变任何事情。作为记录,我是通过rbenv安装ruby的,不确定它使用的是什么编译器。我使用rvm,但安装失败。因此,我不得不用CC=clang rvm install 1.9.3-p484运行ruby安装。我在ruby 2.1.1p76 2014-02-24修订版45161[x86_64-darwin13.0]上。baoist的评论对我有用,但我必须重新安装,而不是安装。你如何重建ruby?
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/pain/.rbenv/versions/2.1.1/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes
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/pain/.rbenv/versions/2.1.1/bin/ruby
/Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/pain/.rbenv/versions/2.1.1/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
from extconf.rb:194:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/pain/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/pain/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/rmagick-2.13.2/gem_make.out
sudo unlink gcc-4.2
sudo mv gcc gcc-foo
sudo ln -s clang gcc