Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems installing nokogiri gem on mac osx snow leopard with Ruby 2.0.0-p353

I have tried installing nokogiri on my rvm ruby 2.0.0-p353 using both homebrew and macports following instructions on the nokogiri installation page found here:

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

In both, I get exactly the same error message of bad file descriptor as shown below:

→ 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

Searching on this error turns up very little information related to jRuby but I am using MRI.

like image 242
Bharat Avatar asked Nov 02 '22 07:11

Bharat


1 Answers

I am answering my own question here for those who may need it. Turns out that this is a problem related to specific 'older' versions of OS-x. I have not upgraded my Mac from Snow Leopard osx 10.6.8 yet -- no specific reason, just intertia :)

In order to install Ruby 2.0.0-p353 or upwards, e.g. Ruby-2.1.0-p0, you should do the following:

rvm install ruby-2.1.0 --disable-binary

as discussed in the following link:

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

This allows me to install nokogiri and debugger gems without any problems.

like image 113
Bharat Avatar answered Nov 08 '22 08:11

Bharat