Using RBenv for Ruby Version Management Cheatsheet
Ruby versions on your development machine need to be carefully managed so you can work on different projects with the right ruby version.
With Rbenv, that’s easy.
Installation
brew install rbenv
rbenv init
benv install
Working with versions
When you want to do something a few months later…
brew upgrade rbenv ruby-build
List all the versions available (in the internet, not just your machine)
rbenv install -l
List all the local ruby versions known
rbenv versions
Show current version
rbenv version
To install a version l
rbenv install 2.6.5
Set the global (overrideable ruby version)
rbenv global 2.6.5
Set a ruby version for the current directory
rbenv local 2.5.0
Refresh Rbenv after changes
rbenv rehash
And that’s it! you have control over your rubies and can work on old rails apps, new rails apps, Middleman and Jekyll sites etc to your hearts content.