- You already have
brew
installed (you can double check that everything is setup withbrew doctor
). - Make sure you don’t have RVM, rbenv, or asdf installed (read this)
- Run
ruby-install 3.1.2 -- --enable-shared
(taken from this article) - Install Rails with chruby and ruby-install:
brew install chruby ruby-install
- Install a specific version of Ruby:
ruby-install 3.0.1 -- --enable-shared
- Configure your Shell:
echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc
echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc
echo "chruby ruby-3.0.1" >> ~/.zshrc
- Quit and relaunch Terminal, then check that everything is working by running
ruby -v
(which should return ruby 3.0.1)
If running into issues with database stuff (like "Could not find gem ‘pg (~> 0.18)’)" or "Unable to find PostgreSQL client library"), ensure you install the following:
brew install postgresql libpq