Search code examples
ruby-on-railsrailsappslearn-ruby-on-rails

Rails - Closed terminal and rebooted machine - now bash tells me rails isn't installed


Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)

I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.

I see this:

`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.`

So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.

I tried also running rvm use ruby-2.1.1@learn-rails first and I still get the error message.

So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.

Regards, Jeff


Solution

  • please type in your shell:

    $ bash --login
    

    and then repeat your commands.

    rails -v 
    

    Also try to call it with the full path: like:

    /your/path/to/rails -v
    

    I think that the shell just doesn't know where rvm/rails etc is located.

    You can solve this by entering:

    $ source ~/.rvm/scripts/rvm