Update Ruby Version

Update Ruby Version

Update Ruby to latest or specified version

Check that Ruby is installed

Open a terminal and type the following command. This should give you the latest version if Ruby is installed or a command not found error if it is not.

ruby -v

Install the Ruby Version Manager

Install the Ruby version manager (rvm) to manage the version of Ruby that is used. Install or update to the latest stable version by executing the following command.

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

If you are installing rvm for the first time, a terminal restart may be required. Or run the following command to refresh

source ~/.rvm/scripts/rvm

Install the Desired Ruby Version

Check the Ruby Website for the latest stable version of Ruby. Or use the following command to install the latest version.

rvm install ruby --latest

If you want to install a different version of Ruby than the latest, you can use the following command to see the available versions.

Ruby versions under the *MRI Rubies section of the results*

rvm list known

Then use the desired version to run the following command

rvm install ruby-[version]

This may take some time to install depending on the number of dependencies and may ask for permission a few times.

Set the Version of Ruby in RVM

Now that the desired version of Ruby is installed it should be the version being run. Verify by running the following command.

ruby -v

If the version returned is not the desired version, rvm needs to be set to know which version should be used. Use the following command to set the desired version as the default version.

rvm --default use ruby-[version]

You can use multiple versions of Ruby on different project by telling rvm which version of Ruby to use at any time by running the following command.

rvm use ruby-[version]