Search code examples
rubyrubygemsrvm

`require': cannot load such file -- rubygems.rb when installing ruby and rubygems with rvm


I was trying to create a fresh installation of Ruby and Rubygems using RVM on Ubuntu 13.10. I had already had an installation before which somehow got corrupted. I decided to reinstall everything, so I ran

rvm implode

which seemed to delete all traces of ruby and rubygems.

However, after reinstalling it using

\curl -L https://get.rvm.io | bash -s stable --ruby
source /home/<username>/.rvm/scripts/rvm

when I run gem install rails, i get the following error:

<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)from <internal:gem_prelude>:1:in `<compiled>'

What's the problem here?


Solution

  • It turns out that my problem was the fact that I had created a symbolic link to gem manually in /usr/bin. After deleting the symbolic link, I reinstalled everything using the following commands:

    rvm implode
    \curl -L https://get.rvm.io | bash -s stable --ruby
    source /home/<username>/.rvm/scripts/rvm
    

    after which

    gem install rails
    

    worked like a charm.