Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS X Mountain Lion "Rails is not currently installed on this system."

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 when I type the rails command (rails s, rails -v, etc), I get this error:

Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.

The result of 'which rails' is /usr/bin/rails

I thought it was a path issue, and perhaps it is, but I can see that /usr/bin is part of my PATH.

Any help? Thanks!

UPDATE: I noticed everything on my other mac with same exact OS works pretty well... I just can't remember how I got it to work that way. If I run 'which rails' I see it's in a totally different place /Users/username/.rvm/gems/ruby-1.9.3-p194/bin/rails

like image 992
botbot Avatar asked Dec 04 '12 03:12

botbot


3 Answers

Just had this issue using rbenv, no idea how this happened, but figured that my ~/.rbenv/shims/rails was empty...

So to fix this:

  • Cleaned empty shims: find ~/.rbenv/shims -empty -delete

  • Then regenerate: rbenv rehash (was not overwriting empty one...)

like image 105
Vincent Guerci Avatar answered Sep 22 '22 09:09

Vincent Guerci


If you're using rbenv, don't forget to rbenv rehash after installing/updating ruby.

like image 19
jazzyfresh Avatar answered Nov 02 '22 17:11

jazzyfresh


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

like image 18
Meltemi Avatar answered Nov 02 '22 15:11

Meltemi