[Ruby] Install Rails on macOS Catalina

less than 1 minute read

Introduction

How to install Rails on macOS Catalina.
Please refer to it when setting up in a local environment such as Rails tutorial.

Prerequisites

  • OS: macOS Catalina
    –Version: 10.15.5
  • Ruby: 2.7.1
  • Rails: 5.1.6

Installation procedure

  1. Install Command line tools from the terminal:
     xcode-select --install
  2. Install Homebrew:
     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  3. Install rbenv:
     brew update
     brew install rbenv
     echo 'eval "$(rbenv init -)"' >> ~/.zshrc
     source ~/.zshrc
    • MacOS Catalina has been changed from bash to zsh.
  4. Install Ruby using rbenv:
     rbenv install 2.7.0
  5. Set default Ruby:
     rbenv global 2.7.0
  6. Install the required software:
     brew install yarn
  7. Rails installation:
     gem install rails -v 5.1.6
    • If you do not restart the terminal, the default Ruby will be called and an error may occur.

reference

Rails Girls Installation Recipe