Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Ruby Version Manager

  • RVM: which is the most established, but also the most intrusive in terms of shell modifications. It manages gemsets and installs different ruby versions. Most of that functionality has been surpassed by Bundler.
  • rbenv: which is lower impact. Does not install ruby versions. It only manages different ruby versions. But it also do things like overriding cd so that it can switch rubies “magically”. They also install shims of commands like gem, ruby, and others that dynamically look up the available Rubies.
  • chruby: even lighter than rbenv.

CHRUBY

  • Install ruby-install
brew install ruby-install
  • Install chruby
brew install chruby
  • add the following line to the ~/.bashrc or ~/.zshrc file:
source /usr/local/opt/chruby/share/chruby/chruby.sh

Auto-Switching

If you want chruby to auto-switch the current version of Ruby when you cd between your different projects, simply load auto.sh in ~/.bashrc or ~/.zshrc:

source /usr/local/share/chruby/chruby.sh 
source /usr/local/share/chruby/auto.sh

chruby will check the current and parent directories for a .ruby-version file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.