Install Ruby on Mac

Introduction

One thing well: rbenv is concerned solely with switching Ruby versions. It’s simple and predictable. If you’re not convenced, read Why choose rbenv over RVM.

Prerequisites

You will need to have Homebrew installed before beginning.

Install

Install rbenv and ruby-build via brew

brew install rbenv ruby-build

Add rbenv to bash so that it loads every time you open a terminal

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

Install the latest version of Ruby.

rbenv install 2.5.0
rbenv global 2.5.0

Check that it installed properly.

ruby -v

Ruby comes pre-installed on Macs so you’ll need to make sure you’ve got the newest version when running the above command. If it’s still showing an older version, talk with your tech lead.

Bundler

Install bundler for gem management.

gem install bundler