Tutorial and Examples on how to Use RVM on Linux

Last updated:


run this to download it:

$ curl -L https://get.rvm.io | bash -s stable

run this to "activate" it:

$ source ~/.rvm/scripts/rvm
  • Hint: to make this permanent, add it to your shell startup script (you need to close and then reopen your terminal for it to take effect)

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

Show available ruby versions

$ rvm list known

downloading specific ruby versions

$ rvm install 2.0.0
$ rvm install 1.9.3

Switching ruby versions

$ rvm use 2.0.0

running scripts as SUDO

using regular sudo messes up with the way RVM adapts your system to use different version of ruby, so use RVM special rvmsudo if you need sudo access

$ rvmsudo gem -v

Set a default version

for example, set 1.9.2 as the default version (only if you've previously installed it)

$ rvm --default use 1.9.2

Shell scripts

everything normal, just use this hashbang:

#!/usr/bin/env ruby


  • RVM is not a function, selecting rubies with 'rvm use ...' will not work.. You must set your shell to work as a login shell. (On Ubuntu, go to Edit->Profile Preferences->Title and Command-> Run command as a login shell). For more information, see this.

  • If you make a mistake and want to remove all currently installed gems for the current gemset, you can do it via

  $ rvm gemset empty


Dialogue & Discussion