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 Ruby
rbenv install 2.4.1
rbenv global 2.4.1
ruby -v
# you should install the Command Line tools as they aren't installed by default (xcode)
xcode-select --install
gem install rails -v 5.1.3
rbenv rehash
rails -v
# create new application
rails new blog
# if webpacker is not installed
brew install yarn
rails webpacker:install
# run server
rails server