At work, our servers are using rbenv to manage the ruby version our apps use but until today I was using rvm in my machine. According to its author, rbenv is supposed to be more lightweight and less invasive than its counterpart rvm. Also, Stephenson is inspired by the Unix philosophy "write programs that do one thing and do it well".
Because of that, instead of being a do-it-all piece of software like rvm, rbenv relies on plugins to allow its users to customize its functionality based on their needs.
Removing rvm and installing rbenv
These steps asume you are using Mac OS X and homebrew.
Step 1: Get rid of rvm by running
Step 2: Check and update your homebrew installation with
brew update and
brew install rbenv.
Step 3: Install rbenv and ruby-build by issuing
brew install rbenv ruby-build.
Step 4: Remove or comment out all references (
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm") to rvm in your .bash_profile, .zprofile or the config file of whatever unix shell you're using.
Step 5: Add the required rbenv initializer to your shell configuration file:
eval "$(rbenv init -)"
You can also install different rbenv plugins that can help you accomplish specific tasks, like:
- rbenv-binstubs if you want to avoid issuing
bundle execeach time you want to run a project-specific environment.
- rbenv-gem-rehash so you don't have to run
rbenv rehashto make your environment aware of a newly installed gem.
Wait...but what about gemsets?!
If, like me, you like having separate sets of gems on a per-project basis, you can make use of the rbenv-gemset plugin.
I was quite happy with rvm but I thought it would be a good idea to use the same tools our servers use in order to minimize issues related to inconsistencies between the development and production environments. With this setup you should have at least the very same basic functionality rvm provides.