jimmyc3po
jimmyc3po

Reputation: 471

Ruby on Rails RVM $PATH issue

I used https://rvm.beginrescueend.com/rvm/install/ to install ruby (ruby 1.9.2p290) & gems (no problems), then installed rails via gem install rails (Rails 3.2.0), but when I try and create a rails app (or issue rails -v) in another directory other than my /user directory I get:

The program 'rails' is currently not installed.  You can install it by typing: 
sudo apt-get install rails

I also noticed that if I issue ruby -v, I get:

The program 'ruby' is currently not installed.  You can install it by typing: 
sudo apt-get install ruby

Obviously, this is a $PATH issue, but it's been so long since I've had to do this that I've totally forgotten how to fix the issue.

As far as I can tell, as long as I create an app or issue command version commands in my /user directory, all goes well.

A few things that might help as well:

which rails gives me: /home/j3/.rvm/gems/ruby-1.9.2-p290/bin/rails

which ruby gives me: /home/j3/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

Upvotes: 20

Views: 38858

Answers (2)

prusswan
prusswan

Reputation: 7101

Seems like your rvm has not been added to PATH properly (or it was broken).

Add this line to your profile settings (.bashrc or .bash_profile)

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

and source the file:

source ~/.bashrc  

or

source ~/.bash_profile

Edit: You seem to have added the echo line to .bashrc by mistake, it should be executed in terminal.

Upvotes: 46

Simpleton
Simpleton

Reputation: 6415

When you try to create a new rails app in whichever directory you are in, be sure to type rvm use {ruby version} and you can also set a default by using rvm use --default {ruby version} to use that rvm version of ruby whenever you load a new terminal up.

Upvotes: 5

Related Questions