Ruby on rails 安装nokogiri Mac OS X 10.8.2 XCode已安装

Ruby on rails 安装nokogiri Mac OS X 10.8.2 XCode已安装,ruby-on-rails,ruby,installation,nokogiri,Ruby On Rails,Ruby,Installation,Nokogiri,试图在山狮上安装nokogiri。我使用的是ruby 1.8.7,但刚升级到1.9.3,但它停止了捆绑包的安装 顺便说一句,我可以通过卸载ruby 1.9.3并恢复到1.8.7来解决这个问题。然而,这显然是一个次优的解决方案,因为我不想在剩下的时间里停留在1.8.7上 Users-MacBook-Pro:sample_app user$ ls Gemfile app doc script Gemfile.lock config lib spec R

试图在山狮上安装nokogiri。我使用的是ruby 1.8.7,但刚升级到1.9.3,但它停止了捆绑包的安装

顺便说一句,我可以通过卸载ruby 1.9.3并恢复到1.8.7来解决这个问题。然而,这显然是一个次优的解决方案,因为我不想在剩下的时间里停留在1.8.7上

Users-MacBook-Pro:sample_app user$ ls
Gemfile     app     doc     script
Gemfile.lock    config      lib     spec
README.md   config.ru   log     tmp
Rakefile    db      public      vendor
Ravins-MacBook-Pro:sample_app user$ bundle
Fetching gem metadata from https://rubygems.org/.......
/Users/user/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Using rake (0.9.2.2) 
Using i18n (0.6.1) 
Using multi_json (1.3.6) 
Using activesupport (3.2.8) 
Using builder (3.0.3) 
Using activemodel (3.2.8) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Using actionpack (3.2.8) 
Using mime-types (1.19) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Using actionmailer (3.2.8) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Using activerecord (3.2.8) 
Using activeresource (3.2.8) 
Using addressable (2.3.2) 
Installing nokogiri (1.5.5) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
extconf.rb:86: warning: Insecure world writable dir /usr/local in PATH, mode 040777
checking for libxml/parser.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/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-libiconv-config
    --without-libiconv-config
    --with-pkg-config
    --without-pkg-config
/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
    from extconf.rb:114:in `<main>'


Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.5.5), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.5'` succeeds before bundling.
Users MacBook Pro:sample\u应用程序用户$ls
Gemfile应用程序文档脚本
Gemfile.lock配置库规范
README.md config.ru日志tmp
Rakefile db公共供应商
Ravins MacBook Pro:示例应用程序用户$bundle
从中获取gem元数据https://rubygems.org/.......
/Users/user/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler.rb:263:警告:路径中的不安全世界可写目录/usr/local,模式040777
使用耙子(0.9.2.2)
使用i18n(0.6.1)
使用multi_json(1.3.6)
使用activesupport(3.2.8)
使用生成器(3.0.3)
使用activemodel(3.2.8)
使用erubis(2.7.0)
使用旅程(1.0.4)
使用机架(1.4.1)
使用机架缓存(1.2)
使用机架测试(0.6.2)
使用远足(1.2.1)
使用倾斜(1.3.3)
使用链轮(2.1.3)
使用actionpack(3.2.8)
使用mime类型(1.19)
使用polyglot(0.3.3)
使用树梢(1.4.10)
使用邮件(2.4.4)
使用actionmailer(3.2.8)
使用arel(3.0.2)
使用tzinfo(0.3.33)
使用activerecord(3.2.8)
使用activeresource(3.2.8)
使用可寻址(2.3.2)
使用本机扩展安装nokogiri(1.5.5)
Gem::Installer::ExtensionBuildError:错误:无法生成Gem本机扩展。
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
extconf.rb:86:警告:路径中的不安全世界可写目录/usr/local,模式040777
正在检查libxml/parser.h...**extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。查看mkmf.log文件了解更多信息
细节。您可能需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--使用zlib dir
--没有zlib dir
--与zlib一起包括
--没有zlib include=${zlib dir}/include
--使用zlib库
--没有zlib lib=${zlib dir}/lib
--使用iconv dir
--没有iconv目录
--与iconv包括
--不带iconv include=${iconv dir}/include
--使用iconv库
--不带iconv lib=${iconv dir}/lib
--with-xml2-dir
--不带-xml2-dir
--with-xml2-include
--不带-xml2-include=${xml2 dir}/include
--with-xml2-lib
--不带-xml2-lib=${xml2 dir}/lib
--使用xslt-dir
--没有xslt目录
--使用xslt包括
--不带xslt include=${xslt dir}/include
--使用xslt库
--不带xslt lib=${xslt dir}/lib
--使用libxslt配置
--没有libxslt配置
--使用pkg配置
--没有pkg配置
--with-libxml-2.0-config
--不带-libxml-2.0-config
--使用pkg配置
--没有pkg配置
--使用libiconv配置
--没有libiconv配置
--使用pkg配置
--没有pkg配置
/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:在“try_do”中:编译器未能生成可执行文件。(运行时错误)
您必须首先安装开发工具。
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in'try_cpp'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in'block in find_header'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in'block in checking_'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in'block(2层)in
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in'open'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in'block in delay'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in'open'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in“推迟”
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in'checking_'
from/Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in'find_header'
来自extconf.rb:114:in`'
Gem文件将继续安装在/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5中以供检查。
结果记录到/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
安装nokogiri(1.5.5)时出错,Bundler无法继续。
在绑定之前,确保'gem install nokogiri-v'1.5.5'成功。
我已经下载了XCODE,包括开发工具,所以我不知道为什么它不会安装nokogiri

当我尝试直接安装nokogiri时,我得到:

ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
extconf.rb:86: warning: Insecure world writable dir /usr/local in PATH, mode 040777
checking for libxml/parser.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/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-libiconv-config
    --without-libiconv-config
    --with-pkg-config
    --without-pkg-config
/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
    from extconf.rb:114:in `<main>'


Gem files will remain installed in /Users/ravinthambapillai/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5 for inspection.
Results logged to /Users/ravinthambapillai/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
错误:安装nokogiri时出错:
错误:无法生成gem本机扩展。
/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby-extconf.rb
extconf.rb:86:警告:路径中的不安全世界可写目录/usr/local,模式040777
正在检查libxml/parser.h...**extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。查看mkmf.log文件了解更多信息
细节。您可能需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--使用zlib dir
--没有zlib dir
--与zlib一起包括
--没有zlib include=${zlib dir}/include
warning: Insecure world writable dir /usr/local in PATH, mode 040777
 brew install libxml2
 brew link libxml2
    checking for libxml/parser.h... *** extconf.rb failed ***
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

        /Users/morozovm/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for libxml/parser.h... *** extconf.rb failed ***

bash-3.2$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Password:
bash-3.2$ gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.5.6
1 gem installed