Coding Hell

Programming and stuff.

Migrate From RVM to Rbenv

I switched from RVM to rbenv for managing Ruby versions on my development machine. RVM does not follow the classic UNIX philosophy; RVM does too many things (Ruby environment management, Ruby compilation and installation, …). It feels kind of bloated to me.

Basic setup

Uninstall rvm:

1
rvm implode

Install rbenv and ruby-build:

1
2
3
brew update
brew install rbenv
brew install ruby-build

Remove RVM initializers from your .bash_profile and instead add rbenv:

1
eval "$(rbenv init -)"

Restart your shell (or re-source .bash_profile).

Now you can start installing Ruby versions:

1
2
3
4
rbenv install 1.9.3-p194
rbenv install 1.9.3-p429
rbenv install 2.0.0-p195
rbenv rehash  # Rehash rbenv shims (run this after installing executables)

Gemsets

If you used RVMs project-specific gemsets and would like to continue to do so, I recommend installing rbenv-gemset. Be sure to install an up-to-date version to support loading .ruby-gemset files (instead of just .rbenv-gemsets files):

1
brew install rbenv-gemset --HEAD

If you already migrated from .rvmrc to .ruby-version (and .ruby-gemset), this setup is 100% compatible with rvm. If not, now is the time to do so: .ruby-version contains the Ruby version (like 1.9.3-p429) while .ruby-gemset contains the name of the gemset (like casino). You can delete .rvmrc afterwards.

Pow

If you are using Pow, add this to your ~/.powconfig:

1
export PATH=$(rbenv root)/shims:$PATH

Comments