We recently switched from RVM to rbenv for managing Ruby versions.
“Make each program do one thing well.” - Tenet #2 of The UNIX Philosophy
The UNIX philosophy espouses an approach to software in which small, sharp tools are designed and used to address discrete needs. By this standard, RVM simply does too much. RVM is responsible not only for changing Ruby versions, but for installing rubies and managing gemsets, as well.
Breaking these responsibilities apart and selecting a tool for each job is a good alternative to using RVM. Along with rbenv, we’re using Bundler to manage gems (replacing gemsets) and ruby-build to install rubies.
- Uses ruby-build to install Rubies
- Relies on Bundler and its’ binstubs to manage gems
- Uses shims to handle executable gems
- Updates shims upon receipt of the
rbenv rehashcommand after new Ruby executables are installed (rehashing can be automated with the gem rehash plugin)
- Installs everything to
Check out our laptop script to see our process for installing rbenv, or follow the steps below.
If you’re a tmux user, be sure to kill all your tmux sessions before installing rbenv to prevent RVM from polluting your environment.
In your root directory, remove RVM from your system:
Restart your shell to ensure you’re beginning your rbenv installation in a clean environment:
exec $SHELL -l
Next, install rbenv using homebrew:
brew update brew install rbenv
Configure your bash or zsh profile:
echo 'eval "$(rbenv init -)"' >> ~/.zlogin source ~/.zlogin
Install ruby-build and rbenv rehash gem using homebrew:
brew install rbenv-gem-rehash brew install ruby-build
Install your preferred version of Ruby and set it as the global default:
rbenv install 2.0.0-p353 rbenv global 2.0.0-p353
Update to the latest Rubygems version:
gem update --system
Install gems critical to Rails development, e.g.
gem install bundler foreman pg rails thin --no-rdoc --no-ri
You can set project-specific Ruby and gem versions by running the
rbenv local command within your project directory:
rbenv local 2.0.0-p247
If you follow the steps above and find you’re having issues with rbenv, check your
echo $PATH. Most likely you’re not seeing the appropriate
If so, you either haven’t added the init to your zsh profile, or something else is mangling the path.