I am on a fresh install of OS X Mountain Lion. I have installed rails via:
sudo gem install rails
Everything seems to install correctly, but wh
After a new
gem install rails
do
rbenv rehash
It worked for me.
If you're using rbenv, don't forget to rbenv rehash
after installing/updating ruby.
Actually, /usr/bin/rails script is just a
# Stub rails command to load rails from Gems or print an error if not installed.
(Comment quoted from the very script's source)
If Rails is installed, then it is loaded. Else, the script will throw the error you pasted in your question.
I had the same problem.
After typing:
sudo gem install rails
and installing rails correctly, just close the Terminal window and open again. Then type:
~ $ rails -v
Rails 4.0.2
So, reseting the Terminal window fix the problem.
Our company uses a script to setup each new machine with a Rails dev environment:
We've open source it, give it a try: https://github.com/platform45/let-there-be-light
Use RVM http://rvm.io or rbenv to install newer Rails versions than what come pre-installed with OS X.
Follow examples on the site https://rvm.io/rvm/install/ but basically:
Install RVM: $ \curl -L https://get.rvm.io | bash -s stable
You can then $rvm list known
to see what Rubies are available to you (lots). And simply $rvm install 1.9.3
to get the most current version of Ruby (which as of this writing is ruby-1.9.3-p327
)
Set that ruby as your default $rvm --default use 1.9.3
Create a default gemset to store your gems $rvm use 1.9.3@mygemset --create --default
Then install Rails $ gem install rails
will get you current which today is same as typing gem install rails -v 3.2.9