Managing Ruby with RVM
Disclaimer: Ruby configurations can be confusing. Between Ruby, RubyGems, RVM, Bundler, etc things can get messed up quickly. Plus with macOS package management like Homebrew, you can butcher your Ruby environment in a matter of minutes. I speak from experience.
I hope to avoid future pain by documenting how I configure and use software related to Ruby.
I use RVM to manage Ruby on my Mac laptop. RVM is very cool and has a lot of great features, most of which I don’t use. macOS comes with Ruby installed, but Apple doesn’t want you messing with it which makes it difficult to manage. Sometimes other software requires a different version of Ruby than my “system Ruby”. I use RVM for forcing macOS to use the version of Ruby that I need. It’s very good at that, and simple to use.
I won’t go over installation here. The RVM site has detailed installation instructions.
This page is a work in progress. I will add commands here as I think of or use them.
RVM Commands - Not a comprehensive list. Just some commands I use frequently.
rvm list known
- Displays all versions of Ruby available for installation.
rvm install 2.6.5
- Installs Ruby version 2.6.5
Then switching between Rubies is easy.
rvm use 2.6.5
- Switches to specified version of Ruby.
rvm use system
- Switches to system Ruby.
rvm upgrade
- Upgrade to specified Ruby version and migrate gems.
rvm get stable
- Upgrades RVM to the latest stable version available.
rvm list
- Displays a list of all versions of Ruby installed with RVM.
rvm info
- Displays current RVM environment information.
rvm current
- Displays selected Ruby version and any gemsets.
Non-RVM Commands - Nevertheless useful while using RVM.
ruby -v
- Check which version of Ruby is loaded.
which ruby
- Displays the path to the Ruby that is running.