Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using RVM on Ubuntu 12.04 to use Rails. The program 'rails' is currently not installed

I installed RVM from scratch following the installation guide on the official website. I installed Rails, created a dummy app and everything worked fine.

I shut off my machine.

The next morning, I turned on the machine again (cold boot) and the tried running "rails -v" from the console, but I get the following error message:

sergio@Sergio-work ~ $ rails -v

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

I can run ruby -v just fine, and get the following message:

sergio@Sergio-work ~ $ ruby -v

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

I can also run gem list just fine, output:

sergio@Sergio-work ~ $ gem list

*** LOCAL GEMS ***

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
faraday (0.8.0)
google_drive (0.3.0)
hike (1.2.1)
httpauth (0.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.2)
json (1.7.3)
libv8 (3.3.10.4 x86_64-linux)
mail (2.4.4)
mime-types (1.18)
multi_json (1.3.6, 1.3.5)
multipart-post (1.1.5)
mysql2 (0.3.11)
nokogiri (1.5.0)
oauth (0.4.6)
oauth2 (0.7.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
sass (3.1.19, 3.1.18)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.4)

Why doesn't my rails -v command work anymore? I used to have this "hack" where I would need to run a command in terminal, "source something something" once, before rails would be "recognized" as an actual command. I had to this once per terminal, meaning if I closed a terminal I had to re-run this after opening a new window terminal.

I can't seem to find this command anymore on the Help section for RVM (where I originally found it) and since I'm kind of new to Linux, these advanced configurations are complex to me.

Any ideas?

like image 718
Only Bolivian Here Avatar asked Jun 22 '12 22:06

Only Bolivian Here


2 Answers

You need to type source ~/.rvm/scripts/rvm before attempting to use Rails.

I believe the RVM installation suggests putting this line (or something similar) in your .bashrc.

Run the following command in Terminal:

echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc

This appends the line source \$HOME/.rvm/scripts/rvm to the end of the .bashrc file.

Doing so ensures that RVM is properly loaded each time you open up a terminal.

like image 184
Justin ᚅᚔᚈᚄᚒᚔ Avatar answered Oct 19 '22 10:10

Justin ᚅᚔᚈᚄᚒᚔ


the proper fix is it https://rvm.io/integration/gnome-terminal/

you should not add source ~/.rvm/scripts/rvm to ~/.bashrc, you can find some more details here: https://rvm.io/support/faq/#shell_login

like image 13
mpapis Avatar answered Oct 19 '22 10:10

mpapis