Rails is Web Application Framework written in Ruby. So I need to install Ruby first. I already have a homebrew and will use it.
brew update brew install rbenv && brew upgrade ruby-build
rbenv is a Ruby version management tool.
rbenv install 2.7.1 rbenv rehash ruby --version
Install Ruby. I have installed the current stable version 2.7.1. And check the ruby version. If you don’t get the correct version, run the following command to add rbenv to bash.
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile source ~/.bash_profile
Next, install Bundler. Bundler is a Gem dependency management tool. Gem is a package on Ruby.
gem install bundler
Finally, install Rails.
gem install rails --no-document
Done. Now I can start my project with Rails.