Install RVM on Ubuntu 18.04.3 LTS

RVM is a command-line tool that lets you easily install, manage, and work with multiple Ruby environments, from interpreters to gems.

RVM has a dedicated package for Ubuntu that we will use for our installation.

Requirements

You must have previously installed software-properties-common to be able to add PPA repositories. If not, open a terminal and run:

$sudo apt install software-properties-common

Add the PPA and install the package

In your terminal:

$sudo apt-add-repository -y ppa:rael-gc/rvm
$sudo apt update
$sudo apt install rvm

Change your terminal window

Now, to always load RVM, change the Gnome terminal to always perform a login.

In the terminal window, click on Preferences, navigate to the Preferences tab, then enable the Run comman as a login shell option.

Reboot

Several changes have been made (scripts to reload, you are now a member of the RVM group) and, for everything to work properly, you need to restart. In most cases, logging out/logging in is sufficient, but some Ubuntu derivatives or certain terminal emulators do not perform a login shell.

Usage

  • Install a Ruby version: rvm install 2.4
  • Use a Ruby version: rvm use 2.4
  • List installed Ruby versions: rvm list known

Conclusion

In conclusion, RVM makes it easy to use multiple versions of Ruby on an operating system.