Oversolving Archive Pages Categories Tags

[out of date] How to install RVM as an unprivileged user in Vagrant

22 April 2014

WARNING: This post is ancient and probably wrong.

The RVM installation instructions for Vagrant install RVM as root.

If you want to install it as an unprivileged user, namely vagrant, do this:

# http://rvm.io/integration/vagrant - edited to install for "vagrant" user only
config.vm.provision :shell, path: '/host/path/to/install-rvm.sh',  args: 'stable', privileged: false # changed
config.vm.provision :shell, path: '/host/path/to/install-ruby.sh', args: '2.1.1',  privileged: false # changed

You can use an unmodified install-rvm.sh:

#!/usr/bin/env bash

curl -sSL https://get.rvm.io | bash -s $1

You should modify install-ruby.sh to be:

#!/usr/bin/env bash

source /home/vagrant/.rvm/scripts/rvm # changed, used to be /usr/local/rvm/scripts/rvm

rvm use --default --install $1        # changed, used to not set --default

shift

if (( $# ))
  then gem install $@
fi

That’s it!

blog comments powered by Disqus
Fork me on GitHub