Ruby-on-rails – Ruby on Rails RVM $PATH issue

ruby-on-railsrvm

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. I'm thinking it's a simple fix but I'm feeling borderline retarded at the moment on how to solve this.

Again, as far as I can tell, as long as I create an app or issue command version commands…etc..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

thanks in advance,
jim

Best Answer

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.

Related Topic