Reputation: 3928
I am able to get a single-user installation working fine for a given ubuntu user. With a single-user installation, after you install rvm, you simply add the source to it in your .bash_profile in your home folder and then on Ubuntu desktop, you go to terminal's Edit > Profile Preferences > Title and Command > Run Command as a Login shell. And now you can begin switching rubies and adding gemsets:
rvm list
rvm install 1.9.3
rvm use 1.9.3
rvm gemset create MyGemSet
rvm use 1.9.3@MyGemset
rvm gemdir
gem install passenger
However. I am using Passenger with a production server setup so I prefer to use rvm system-wide installation. So I install rvm and ruby system-wide:
sudo -i
curl -L https://get.rvm.io | bash -s stable --ruby
# echo '[[ -f "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bash_profile
# echo 'PATH=$PATH:/usr/local/rvm/bin' >> ~/.bashrc
# rvm list
rvm rubies
ruby-1.9.3-p547 [ i686 ]
=* ruby-2.1.2 [ i686 ]
# rvm use 1.9.3
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
The reason why I need to run "rvm use 1.9.3" as root is because I want to create a gemset for 1.9.3 and I cannot do that as a regular user since I am using a system-wide install. The error says "You need to change your terminal emulator preferences to allow login shell.". But I am on Ubuntu and the root user is not enabled by default nor do I want to unlock the root user account for security reasons. So how do we handle situations where we want a system-wide install on Ubuntu Desktop (I'm using 12.04 in this case)?
Upvotes: 0
Views: 907
Reputation: 16506
In addition to Santosh's answer(which loads rvm everytime), to load it just once, you can also try:
source ~/.rvm/scripts/rvm
Also if you want to load it automatically everytime, as suggested by Santosh, after you add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
to your bashrc, you need to reload your bashrc. Here:
source ~/.bashrc
Upvotes: 2
Reputation: 29124
Add this to your .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
If rvm is not in your home folder, you can use the absolute path
[[ -f "<path-to-rvm>/scripts/rvm" ]] && source "<path-to-rvm>/scripts/rvm"
Upvotes: 1