update 2012: I switched back to rvm

I decided to move from RVM to rbenv. rbenv is getting a lot of hype lately. Instead of overriding cd like rvm, it uses the already available UNIX functionality like adjusting the PATH to the ruby to use.

My move is mainly motivated by curiosity, although I have had some problems with rvm before and I hope that using rbenv will avoid them. During the migration, I mainly followed this excellent guide. Here is a summary with some additional information:

    # remove all rvm files
    $ rvm implode
    WARN: Are you SURE you wish for rvm to implode?      
    This will recursively remove /Users/robin/.rvm and other rvm traces?      
    (type 'yes' or 'no')> 
    yes
    Removing rvm-shipped binaries (rvm-prompt, rvm, rvm-sudo rvm-shell and rvm-auto-ruby)
    Removing rvm wrappers in /Users/robin/.rvm/bin
    Hai! Removing /Users/robin/.rvm

    /Users/robin/.rvm has been removed.    
    rvm has been fully removed. Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they     exist still.%

    $ rm ~/.rvmrc

    # install rbenv and ruby-build
    $ brew update
    $ brew install rbenv
    $ brew install ruby-build

Now we add eval "$(rbenv init -)" to .zshenv as described in the rbenv README. After starting a new session, we should be able to see the current ruby being used with rbenv global (which should be system). Run rbenv versions to see all rubies that can be installed with ruby-build. To install ruby 1.9.2, run rbenv install 1.9.2-p290. Now you can set this as the default ruby with rbenv global 1.9.2-p290. Deleting a ruby version and its gems is as easy as rm -r ~/.rbenv/versions/[VERSION].

Bundler

rbenv does not come with gemset support. rbenv-gemset is an extension for rbenv that brings this functionality to rbenv. However, bundler is a pretty awesome tool for managing gems and dependencies so I decided to stick only with that. After installing the gem and running bundle install in one of my projects I noticed that the binaries of the dependencies were missing. Usually with rbenv, you only have to install the gem and run rbenv rehash to make the binaries available.

After researching this a little bit I noticed, that the missing binaries are not a problem but a feature. Binaries of projects managed with bundler are usually executed with bundle exec [BINARY] anyway. Since I am lazy I usually run bundle exec only when I know that a different version than the globally available one is specified in the Gemfile. However, it is far safer to always use bundle exec. Running them this way works just fine and with an alias like alias be=bundle exec it is not so much overhead.

During my research of the missing binaries in bundler I stumbled upon bundle config and the .bundle/config file. The .bundle/config file can be in you app or home directory and defines the bundler configuration. The following two commands cause bundle to always install gems and binaries in the project folder. This is great because it does not clutter up my global gemset. However, don't forget to add both directories to your .gitignore file ;)

$ bundle config PATH vendor/bundle
$ bundle config BIN .bin