Skip to main content

Ruby Version Management

Published: Aug 4th, 2020

This is part of Joyful Rails, a list of recommendations to make developing your Rails app more productive and joyful.

In this article, we are talking about Ruby version management.

When

A Ruby version manager is helpful when you want to easily switch to a different version of Ruby, either to get new features or to work on different projects.

Why

The Ruby runtime included by default on your machine is probably not the one you want to use. The default Ruby on MacOS requires root privileges to install gems and tends to lag far behind the current Ruby version.

Also, your different Ruby projects may use different Ruby versions.

What

RVM, aka the Ruby Version Manager, manages multiple versions of Ruby and its libraries (called gems).

How

To install RVM, run this command:

\curl -sSL https://get.rvm.io | bash -s stable

If you already have RVM, update it with rvm get.

To switch Ruby version, run rvm use ruby-<version_number>. You can see the latest Ruby version on the Ruby website.

Alternatives

rbenv is another (possibly better) option.