Rails Installation Macos 6 4 22

Recently I started learning Ruby and Rails. In order to get up and running, I started with the Ruby On Rails “Getting Started” page, but I found that after installing the rails gem I was seeing the following error on running rails --version:

The program 'rails' is currently not installed. 
You can install it by typing: sudo apt-get install rails rails: command not found

I had used homebrew to install Ruby and was using macOS Monterey.

I found that I needed to delete the version I installed with homebrew and instead followed the Go Rails MacOS Monterey Setup Guide which uses a package manager to install and manage ruby versions.

A similar guide is the Mac Install Guide.

TLDR; if you follow the basic homebrew setup for rails on M1 MacOs, it will not just “work”. Look to one of the linked mac-specific setup guides to save yourself some headache with import path configuration.