Introduction
RVM (Ruby Version Manager) is a shell tool that lets developers install, manage, and work with multiple Ruby environments on a single machine. It compiles Ruby from source, manages gemsets for dependency isolation, and automatically switches Ruby versions when entering project directories. RVM has been the standard Ruby version manager since 2009.
What RVM Does
- Installs multiple Ruby interpreters (MRI, JRuby, TruffleRuby) from source or binaries
- Switches between Ruby versions globally, per shell, or per project directory
- Manages gemsets to isolate gem dependencies between projects
- Reads .ruby-version and .ruby-gemset files for automatic per-project switching
- Provides wrappers for cron jobs and scripts that need a specific Ruby environment
Architecture Overview
RVM works by modifying shell environment variables (PATH, GEM_HOME, GEM_PATH) to point to the selected Ruby installation and gemset. It installs Ruby versions into ~/.rvm/rubies/ and stores gemsets under ~/.rvm/gems/. A shell function (loaded via sourcing a script in your profile) intercepts the cd command to detect .ruby-version files and switch environments automatically. RVM can compile Ruby from source using its own build recipes or install precompiled binaries when available.
Self-Hosting & Configuration
- Install via the official installer script: curl -sSL https://get.rvm.io | bash -s stable
- Source the RVM script in your shell profile: source ~/.rvm/scripts/rvm
- Install Ruby versions with rvm install (e.g., rvm install 3.3.0)
- Create per-project .ruby-version and .ruby-gemset files for automatic switching
- Use rvm autolibs enable to let RVM install required system dependencies automatically
Key Features
- Compiles Ruby from source with optimized build flags or installs precompiled binaries
- Gemsets provide dependency isolation without requiring Bundler for every project
- Automatic environment switching on directory change via .ruby-version files
- Named gemsets for maintaining separate gem environments per project or client
- Supports MRI, JRuby, TruffleRuby, Rubinius, and other Ruby implementations
Comparison with Similar Tools
- rbenv — lighter approach using shims instead of shell functions; no gemsets built in
- chruby — minimal Ruby switcher with no installer; pair with ruby-install
- asdf + ruby plugin — multi-language version manager; RVM is Ruby-specific with gemsets
- mise — modern polyglot tool manager; RVM has deeper Ruby-specific features
- Docker — full isolation via containers; RVM provides lighter per-user Ruby management
FAQ
Q: RVM vs rbenv — which should I use? A: Use RVM if you want built-in gemsets and an all-in-one installer. Use rbenv if you prefer a minimal shim-based approach.
Q: Do I still need Bundler with RVM gemsets? A: Bundler is still recommended for reproducible dependency resolution. Gemsets provide an extra isolation layer on top of Bundler.
Q: How do I update RVM itself? A: Run rvm get stable to update to the latest stable release.
Q: Does RVM work on macOS with Apple Silicon? A: Yes. RVM compiles Ruby natively for ARM64 on Apple Silicon Macs.