Ariel
Ariel

Reputation: 3611

Installation of rubygems fails when trying to install Ruby 2.0.0 with RVM

I'm working on my first Rails app. I just updated from Rails 3.2.13 to Rails 4 and now I was trying to install ruby 2.0.0 but I've been stuck all day getting the same error. I found several questions here on SO and elsewhere, many of them with accepted answers, but simply none of the solutions worked for me.

In the end I ended up completely removing all ruby versions and deleting rvm altogether, but even trying to install it again from scratch results in the same errors. I'm on OSX 10.8.4.

The error:

Extracting rubygems-2.0.6 ...
Removing old Rubygems files...
Installing rubygems-2.0.6 for ruby-2.0.0-p247......................
Error running 'env GEM_PATH=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247@global:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247:/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247@global GEM_HOME=/Users/arielpontes/.rvm/gems/ruby-2.0.0-p247 /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -d /Users/arielpontes/.rvm/src/rubygems-2.0.6/setup.rb',
please read /Users/arielpontes/.rvm/log/ruby-2.0.0-p247/1375132582_rubygems.install.log
Installation of rubygems did not complete successfully.
Saving wrappers to '/Users/arielpontes/.rvm/wrappers/ruby-2.0.0-p247'...

The logs:

[2013-07-29 18:23:54] /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:1091 - cannot load such file -- rubygems/defaults/ruby
/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require': dlopen(/Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
  Referenced from: /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle
  Reason: image not found - /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/psych.bundle
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:1:in `<top (required)>'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems.rb:600:in `load_yaml'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:313:in `load_file'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/config_file.rb:190:in `initialize'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `new'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:66:in `do_configuration'
    from /Users/arielpontes/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:46:in `run'
    from setup.rb:45:in `<main>'

Anybody has any idea about what I could do to fix it?? I've tried the solution to this question but no avail. Thanks.

Upvotes: 1

Views: 2189

Answers (1)

Ariel
Ariel

Reputation: 3611

Well, I finally managed to fix it! Sorry if I ended up polluting SO. I'll reply to my question anyway in case somebody runs into similar problems and ends up here in the future.

It turned out I had a messed up installation of libyaml, "Installed but not linked", according to Homebrew. I figured it out after trying this solution. So I uninstalled libyaml and killed it with sudo rm -rf and installed it again. I ran into this problem but the accepted answer solved it. After this I installed RVM from scratch with stable ruby and it finally worked!

Upvotes: 6

Related Questions