HomeWeb DevelopmentRuby Version Manager

Ruby Version Manager

In this post we learn to manage Ruby versions with the Ruby Version Manager or RVM.

Ruby is a useful language and we use it extensively. As developers we need the ability to quickly move between installed versions of Ruby as necessary to work against. This need was recently highlighted by the release of OSX Mavericks which implemented core changes that could affect development environments adversely.

We manage different versions of ruby with the Ruby Version Manager. We will explore how to:

  • Install RVM.
  • Find available versions of Ruby.
  • Use RVM to install Ruby.
  • Completely remove the installed RVM and Ruby.

This demonstration is performed on OSX Mavericks, but the concepts will easily translate to a Linux user.

Install RVM

  1. Install RVM.$ curl -sSL https://get.rvm.io | bash -s -- --auto-dotfiles
  2. Exit Your Terminal and restart it!!!
  3. Verify the installation.$ rvm -v
  4. Find available versions of Ruby.$ rvm list known
  5. Use RVM to install Ruby version 2.1. Use the –force flag to require recompilation of the gems.$ rvm install 2.1 --force
  6. Tell the system to use the installed Ruby as the default.$ rvm use 2.1 --default

Purge RVM

  1. Completely remove the installed RVM and Ruby.$ rvm implode
  2. Manually remove RVM references from the respective personalization files:$ ~/.profile, $ ~/.bashrc $ ~/.zshrc $ ~/.bash_profile $ ~/.zlogin