I am trying to set up an environment as per this tutorial http://railstutorial.org/book#sec:1.2.2.3 however I get the below error when running ‘rails -v’
bash-3.2$ rails -v
/Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:219:in `activate'
from /Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
from /usr/bin/rails:18:in `<main>'
Has anyone had this before?
Incase anyone else has this problem and the marked answer doesn’t solve it, here is what fixed it for me:
Don’t use sudo.
commands as root, another user in
another shell and hence all of the
setup that RVM has done for you is
ignored while the command runs under
sudo (such things as GEM_HOME,
etc…). So to reiterate, as soon as
you ‘sudo’ you are running as the
root system user which will clear out
your environment as well as any files
it creates are not able to be
modified by your user and will result
in strange things happening. (You
will start to think that someone has
a voodoo doll of your
application…)”
Taken from here