Homebrew Package Manager makes it easy to install a variety of software packages, and is used by the following Ruby Version Manager (rvm).
Installing Homebrew involves copying and pasting /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You may need to enter your computer password to complete the installation.
Run $ brew doctor. Brew is super great at telling you what else it may need. Sometimes there are file permissions to fix. Sometimes there's a warning that can be ignored. If there's anything ever wrong with Brew, brew doctor will usually be able to tell you what it is and how to fix it.
Ruby Version Manager (rvm) makes it easy to install, manage, and switch between Ruby versions.
Installing rvm is done in the Terminal: $ \curl -sSL https://get.rvm.io | bash -s stable
The installation won't take long. When it's done, close your Terminal (⌘-Q) and then reopen it. You can find the ⌘ or 'Command' key next to your spacebar. On a Mac pressing both command and 'Q' will quit the active application.
Verify all's well by running $ rvm -v. You should see something like rvm 1.28.0 (latest).
Type the following into your terminal: $ rvm install 2.4.0
Type the following into your terminal: $ gem install rails
Running $ rails db:reset