How to install Rails 5.x or 6.x on a Mac


We are going to use four different package managers to set up our environment. Homebrew is a package manager for Mac. We will use brew to install rbenv. rbenv is a Ruby manager that makes it easy to install modern versions of the language. RubyGems is a package manager for Ruby that will help you install current versions of Rails. Finally, yarn is the package manager to help you install and manage JavaScript web-frameworks such as Vue.js.

Install Ruby using rbenv and brew

Step 1 of this tutorial will help you install rbenv and brew.

Now that you've installed rbenv, let's install Ruby and Rails.

rbenv install 2.5.3

Install Rails using gem

Using your specific version of Ruby 2.5.x, install Rails 5.2.x without documentation.

RBENV_VERSION=2.5.3 rbenv exec gem install rails --version 5.2.1 --no-document

Install Yarn using brew

yarn is a package manager to install Vue Javascript library.

brew install yarn