RVM on Ubuntu

24 Mar 2012

I have encountered a very annoying problem.

I want to use Ruby on Ubuntu. So, I installed RVM and shit.

Now I found out that all gems' executables didn't work. It threw an error like this one:

/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find heroku (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError) from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1230:in `gem' from /usr/local/rvm/gems/ruby-1.9.3-p125/bin/heroku:18:in `<main>'

I tried changing everything and it didn't work.

Then, I have realized that the error message says that it cannot find other gems. Here is the error message:

Could not find heroku (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)

I have figured out that the problem is GEM_PATH variable is not set. (I'll tell you about how I have figured that out later).

So, here is how you solve the problem:

export GEM_PATH=/usr/local/rvm/gems/ruby-1.9.3-p125

Please beware that you might already have GEM_PATH set, but it was not valid.

If you want it to be permanent, then add that line to `~/.bashrc`.

How I have figured it out

What I did is that I installed RVM on the root user, and it turns out that everything works fine. Since I was suspicious that it was because of the gem's path configuration, I have checked out the environment variables.

What I have found is that the root user has GEM_PATH set, while other users do not have one.

And that was it.

Give it a kudos