Do this to install Ruby and Rails on mac.
$ 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' >> ~/.zshrc
$ source ~/.zshrc
# Install Ruby
$ rbenv install 3.1.0
$ rbenv global 3.1.0
$ ruby -v
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.