3/6/2018 - 3:06 PM

Setup Environment for Ruby on Rails (Mac OS X 10.9 or higher)

1. Install Command line tools on terminal

xcode-select --install

2. Install Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. Install rbenv

brew update
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

4. Build Ruby with rbenv

You can find the newest version of Ruby with the command rbenv install -l

rbenv install 2.4.2

5. Set default Ruby

rbenv global 2.4.2

6. Install rails

gem install rails --no-document

7. Check the environment

rails new myapp
cd myapp
rails server

8. Go to http://localhost:3000 in your browser, and you should see the ‘Yay! You’re on Rails!’ page.