Blog icon

Moving from RVM to RBENV

By Ben Wiseley,
Ben Wiseley
Scroll down to read

Moving from RVM to RBENV is pretty straightforward but here are some gotcha's I ran into migrating my two system.

First: rvm implode

rvm implode

At least on my system I saw a bunch of permission errors while this was running. Solve this by manually destroying .rvm after rvm implode finishes.

Second: clean up left overs

sudo rm -rf ~/.rvm
sudo rm -rf ~/.rvmrc
sudo rm -rf /etc/rvmrc

Third: remove gems

I wanted to make sure I didn't have anything kicking around from the old version so I removed all the gems.

sudo gem list | cut -d" " -f1 | xargs sudo gem uninstall -aIx

For older gem versions you might need to loose the lx options and run more than once

sudo gem list | cut -d" " -f1 | xargs sudo gem uninstall -a

Fourth: install RBENV

On my system ~/.profile is my bash profile. This might be different on your system. Do a ls -la and look for .profile, .bashprofile, .bashrc - something like that.

cd
git clone git://github.com/sstephenson/rbenv.git .rbenv

Then add this to the bottom of your ~/.profile

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Quit and restart terminal

Fifth: install ruby-build and add you rubies

git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh

Install a ruby version and set it to be the default

rbenv install 1.9.3-p0
rbenv local 1.9.3-p0
rbenv rehash

Now's a good time to also update your ruby-gem to the latest

sudo gem update --system

Check to make sure you're actually using rbenv

> which ruby
/Users/wiseleyb/.rbenv/shims/ruby
> which irb
/Users/wiseleyb/.rbenv/shims/irb
> which rails
/Users/wiseleyb/.rbenv/shims/rails

If things aren't pointing where you expect try removing the /usr/bin/whatever that's misbehaving. Reinstalling. Restarting terminal. Rechecking. This at least worked for problems I had with rails. Which I solved by:

sudo rm /usr/bin/rails
sudo gem install rails

reload bash

. ~/.profile

To find out how reinteractive can turn your web application vision into reality, get in touch with us through our contact form or call us on +61 2 8019 7252.