Setup ruby environment on macOS - rbenv
Install rbenv and ruby-build
brew install rbenv
Set up rbenv integration with your shell
rbenv init
rbenv-doctor to verify the installation
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
List available ruby versionsr
rbenv install -l
Install particular ruby version
rbenv install 3.0.0
List installed ruby versions
rbenv versions
Set a ruby version as the global ruby to use
rbenv global 3.0.0
Check current ruby version in use
ruby -v
Set a directory/application/tool specific ruby version
cd directory-of-app-or-tool
rbenv local 3.0.0
Unset a directory/application/tool specific ruby version
cd directory-of-app-or-tool
rbenv local --unset