Skip to content

Instantly share code, notes, and snippets.

Last active February 21, 2023 08:16
What would you like to do?
Guide to switching to rbenv bliss from RVM hell

RVM to rbenv

Why? @sstephenson explains it best here.

1) remove RVM from your system

This should get rid of the rvm dir and any installed rubies:

$ rvm implode
$ gem uninstall rvm
$ rm ~/.rvmrc
$ rm /etc/rvmrc

2) remove any remaining traces of RVM

Remove anything RVM-related from your PATH in:

  • .profile
  • .bash_profile
  • .bashrc

3) install rbenv

Using homebrew:

$ brew update
$ brew install rbenv ruby-build

4) install rubies for rbenv

# list all available versions:
$ rbenv install -l

# install a Ruby version:
$ rbenv install 2.0.0-p247

Note: if you install a new version of ruby or a new gem and something isn't working, run $ rbenv rehash

5) switching ruby versions in rbenv

There are two easy ways of switching versions.

Specifying the right version of ruby for individual projects

Lots of ruby projects (including sassquatch) include a .ruby-version file. This file tells rbenv which ruby version to use for the directory.

Manually switching rubies

# show versions currently installed and indicate current version
$ rbenv versions
# set ruby version for a specific dir
$ rbenv local 1.9.3-p327
# set ruby version globally
$ rbenv global 1.9.3-p327

6) install the bundler gem

You should install the bundler gem because it's a nice way to manage gem dependencies in a project. For example, here's the Gemfile in sassquatch that bundler uses to manage gem dependencies for the projcet.

$ sudo gem install bundler

7) never fight with RVM again

enjoy your new lease on life

Copy link

ckib16 commented Dec 13, 2016

Heads up - be sure to install these PATH settings in your .bash_profile after installing rbenv

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile  
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile  

This will make sure it installs gems & rubies using rbenv
Should not have to use sudo to install gems with rbenv as listed in #6 currently.


Copy link

AustineA commented Aug 5, 2021

for Zsh run the following

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc source ~/.zshrc

Copy link

Thanks @AustineA

fwiw in Zsh:

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment