Faisal Hassan
Faisal Hassan

Reputation: 406

RVM not working on Vagrant

No command 'rvm' found, but there are 21 similar ones rvm: command not found. Comes up when I'm in Vagrant on linux ubuntu 14.04.

Installed Vagrant and VirtualBox.

Upvotes: 0

Views: 2625

Answers (2)

mikel
mikel

Reputation: 113

I had this problem as well. I found that I had to add the full path for rvm in the provisioning script. The path is added to the environmental $PATH variable but not known to Vagrant during the provisioning.

/usr/local/rvm/bin/rvm install ruby-2.4.0

After provisioning:

[vagrant@Ruby ~]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin: \
/usr/local/rvm/bin:/home/vagrant/.local/bin:/home/vagrant/bin

[vagrant@Ruby ~]$ which rvm
/usr/local/rvm/bin/rvm

Another option might be to source /etc/profile before executing an rvm, but I have not tried that yet.

Upvotes: 0

Josh Barker
Josh Barker

Reputation: 27

Found over at rvm command not found


Your problem is that RVM is not loaded when you open a new terminal.

To solve this, run this command line: (if using login-shell)

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

Or this (if using non-login shell):

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

This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).


You could also try, if you're sshd into your box, running sudo apt-get update and then installing it?

Upvotes: 1

Related Questions