Question

I have followed the instructions of how to do a multi-user install of rvm on Ubuntu. I did not do this as root. When i do "source /etc/profile.d/rvm.sh" then I can use rvm. However if I log out and log in again and do "rvm -v" I get "bash: rvm: command not found". Can I make it so that I don't have to write "source /etc/profile.d/rvm.sh"?

As non-root user by the name of "user1" I did:

# multi-user install
\curl -sSL https://get.rvm.io | sudo bash -s stable

# add user1 to rvm group
sudo adduser user1 rvm

source /etc/profile.d/rvm.sh

Then I exit the shell and start a new one:

user1@72265e666e07:/$ rvm -v
bash: rvm: command not found
Was it helpful?

Solution

Look at answers for this question:

From your problem description it seems that the rvm script needs to be loaded only once, during login. As far as I know, Ubuntu reads /etc/profile/ and ~/.profile during login (the graphical login, independent of bash). That means, after logging out and a logging in once, the rvm script should be active. If it still doesn't work, then perhaps the rvm script needs to be loaded for every bash session. If that is the case then bashrc is the more appropriate place for the script.

OTHER TIPS

The problem for me was that rvm was not in any of my bash init files. I thought that that should be installed/configured automatically when installing rvm, but apparently it was not! I had to run the two following commands to add rvm initialization globally for every user.

printf '\n\nif [ -s "$HOME/.rvm/scripts/rvm" ] ; then\n  . "$HOME/.rvm/scripts/rvm"\nelif [ -s "/usr/local/rvm/scripts/rvm" ] ; then\n  . "/usr/local/rvm/scripts/rvm"\nfi' >> /etc/profile
printf '\n\nif [ -s "$HOME/.rvm/scripts/rvm" ] ; then\n  . "$HOME/.rvm/scripts/rvm"\nelif [ -s "/usr/local/rvm/scripts/rvm" ] ; then\n  . "/usr/local/rvm/scripts/rvm"\nfi' >> /etc/bash.bashrc

After I had run these two commands it is possible to reach rvm directly when I log in to my user "user1".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top