使用Ruby 2.0.0-p353在mac osx雪豹上安装nokogiri gem的问题

时间:2014-01-07 22:42:30

标签: macos gem nokogiri ruby-2.0

我已经尝试使用homebrew和macports在我的rvm ruby​​ 2.0.0-p353上安装nokogiri,按照nokogiri安装页面上的说明进行操作:

http://nokogiri.org/tutorials/installing_nokogiri.html

在两者中,我得到完全相同的错误文件描述符错误消息,如下所示:

→ sudo gem install nokogiri
Fetching: mini_portile-0.5.2.gem (100%)
Successfully installed mini_portile-0.5.2
Fetching: nokogiri-1.6.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
/Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:292:in `initialize_copy': Bad file descriptor (Errno::EBADF)
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:292:in `initialize_dup'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:292:in `dup'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:292:in `<module:Logging>'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:289:in `<module:MakeMakefile>'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:47:in `<top (required)>'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/Bharat/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from extconf.rb:5:in `<main>'

extconf failed, exit code 1

搜索此错误会显示与jRuby相关的非常少的信息,但我使用的是MRI。

1 个答案:

答案 0 :(得分:2)

我在这里为那些可能需要它的人回答我自己的问题。事实证明,这是与特定的“旧版”OS-x相关的问题。我还没有从Snow Leopard osx 10.6.8升级我的Mac - 没有具体原因,只是intertia:)

为了安装Ruby 2.0.0-p353或更高版本,例如Ruby-2.1.0-p0,您应该执行以下操作:

rvm install ruby​​-2.1.0 --disable-binary

如以下链接所述:

https://github.com/wayneeseguin/rvm/issues/2511

这允许我毫无问题地安装nokogiri和调试器gems。