Gregor Menih
Gregor Menih

Reputation: 5126

Start Rails on system startup

I have a problem with my Ruby on Rails installation. I installed Ruby with RVM, then used gem install rails to install Rails. The rails command worked in terminal, but if I close the terminal and try using rails again it gives me an error:

grega@spaceship:~$ rails -v
The program 'rails' can be found in the following packages:
 * rails
 * ruby-railties-3.2
Try: sudo apt-get install <selected package>

Using rvm -v or ruby -v works.

grega@spaceship:~$ rvm -v

rvm 1.18.21 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

grega@spaceship:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

To get rails working again I have to execute source .rvm/scripts/rvm

RVM is added to the .bashrc file: PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

Am I forgetting something, that prevents me from using rails on startup?

Upvotes: 0

Views: 109

Answers (1)

Intrepidd
Intrepidd

Reputation: 20878

Add this to your bashrc :

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Upvotes: 2

Related Questions