Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Switch from RVM to rbenv

Switch from RVM to rbenv:

Get Rid of RVM if it's installed:

rvm implode

Cleanup your .bash_profile/.bashrc/.zshrc file to remove RVM from the path:

You should have something like this left from RVM. Delete it from the file. ``[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"```


Ensure your homebrew is working properly and up to date:
brew doctor
brew update

Install Rbenv via homebrew:
brew install rbenv
brew install ruby-build
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility:

Afterwards you'll still need to run rbenv init. You'll only ever have to do this once.

(NOTE: Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.)

Restart your shell so that PATH changes take effect!

(Opening a new terminal tab will usually do it.) Now check if rbenv was set up by typing rbenv into the terminal. You should see something like this:

rbenv 0.4.0
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   install     Install a Ruby version using ruby-build
   uninstall   Uninstall a specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List all Ruby versions available to rbenv
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme

Yay, works!


Using rbenv:

To see a list of available Ruby versions for install:
rbenv install -l

PRO-TIP: Don't see the ruby version listed you are looking for (aka specified in your gemfile?)? Then you probably are due for a brew update! brew update & brew upgrade ruby-build

Check the Ruby versions list again...
rbenv install -l
To install a ruby version:
rbenv install 2.3.0
Before you can bundle and install gems, add bundler:
gem install bundler
Then you can bundle & install all the gems in the gemfile!
cd your-project-folder
bundle install
Set a project specific (local) ruby version:
cd your-project-folder
rbenv local 2.3.0

Rbenv info: https://github.com/rbenv/rbenv#installation

Removing RVM tips: https://richonrails.com/articles/uninstalling-rvm

@amykotas
Copy link

amykotas commented Mar 7, 2016

Thank you so much for all of this!

@daveomcd
Copy link

daveomcd commented Aug 6, 2020

@traumverloren, do you know if after doing these steps on my development machine - would I use this same process to switch over on my production server? I'm currently deploying to an ubuntu server with Capistrano. Thanks - this was very helpful resource to read through.

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