Install rbenv and ruby

rbenv is a great tool which enables you to install and pick a ruby version for your application. It is light weight and works by inserting a directory of shims at the front of the PATH

Install Homebrew – a great package manager:

ruby -e "$(curl -fsSL"

Install rbenv – manage different versions on ruby:

brew install rbenv ruby-build

Add following to the end of your .bashrc / .zshrc / .bash_profile

eval "$(rbenv init -)";

Check rbenv:

type rbenv #output: rbenv is a shell function

List rubies:

rbenv install -l

Install ruby:

rbenv install 2.2.0

Run this command when you install new version of ruby or a gem that provides commands:

rbenv rehash

List installed ruby versions:

rbenv versions

Use ruby:

rbenv global 2.2.0 #set ruby-2.2.0 as the global ruby version
rbenv local 2.1.0 #set ruby-2.1.0 as app specific version
rbenv shell 2.3.0-dev #set ruby-2.3.0-dev for the shell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s