Install Ruby with Chruby
Install Ruby with chruby on a Mac. Use chruby and ruby-install for managing Ruby versions on macOS.
Chruby is a solid, low-maintenance choice for Ruby version switching on macOS, staying small, simple, and predictable. Use chruby when you want a focused Ruby manager instead of a general-purpose environment manager.
As of 2026, I prefer either Mise or rv as version managers. I recommend Mise for managing multiple languages or rv for managing Ruby only. For a guide that compares version managers and shows the best way to install Ruby, see Choose a Ruby Version Manager for Mac. Alternatively, if you are a casual user and will not be using Ruby frequently, you can use Homebrew to install Ruby. See the article, Install Ruby with Homebrew.
Chruby remains a solid choice for developers who don't want to change version managers.
Setting up Ruby is part of configuring your Mac for development. See the full roadmap to set up a Mac for software development.
Before you get started
You'll need a terminal application to install Ruby. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it is FREE and worth a try.
First steps to install Ruby with chruby
You may want to check the macOS version. Take the time to make sure your operating system is up to date and update macOS to the latest macOS version. Then Set Up a Mac Like a Pro with all the best settings and preferences.
You may have already installed Xcode Command Line Tools and Homebrew, the macOS software package manager. Install Homebrew if you haven't done so, and run brew doctor to make sure it is ready.
Ruby-install and Chruby
Open a terminal application and use Homebrew to install the ruby-install utility and the chruby Ruby version manager.
$ brew install ruby-install chruby
You'll see beer mug emojis as Homebrew installs the utilities.
$ brew install ruby-install chruby
==> Fetching downloads for: ruby-install and chruby
✔︎ Bottle Manifest ruby-install (0.10.2) Downloaded 2.4KB/ 2.4KB
✔︎ Bottle Manifest chruby (0.3.9) Downloaded 1.9KB/ 1.9KB
✔︎ Bottle ruby-install (0.10.2) Downloaded 30.1KB/ 30.1KB
✔︎ Bottle chruby (0.3.9) Downloaded 19.5KB/ 19.5KB
==> Pouring ruby-install--0.10.2.all.bottle.tar.gz
🍺 /opt/homebrew/Cellar/ruby-install/0.10.2: 31 files, 106.7KB
==> Running `brew cleanup ruby-install`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Pouring chruby--0.3.9.all.bottle.3.tar.gz
==> Caveats
Add the following to the ~/.bash_profile or ~/.zshrc file:
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
To enable auto-switching of Rubies specified by .ruby-version files,
add the following to ~/.bash_profile or ~/.zshrc:
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
==> Summary
🍺 /opt/homebrew/Cellar/chruby/0.3.9: 13 files, 55KB
==> Running `brew cleanup chruby`...
==> Caveats
==> chruby
Add the following to the ~/.bash_profile or ~/.zshrc file:
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
To enable auto-switching of Rubies specified by .ruby-version files,
add the following to ~/.bash_profile or ~/.zshrc:
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
Verify that ruby-install is available:
$ ruby-install -V
ruby-install: 0.10.1
You must add Chruby to the system environment before you can use it to manage Ruby versions.
Add Chruby to the .zshrc file
Edit the ~/.zshrc file in your text editor. See Shell Configuration and setting the Mac Path for background and details.
Add configuration commands for Chruby:
### ~/.zshrc
# enable chruby
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
chruby ruby-4.0.2
The first two lines (with the hash characters) are comments. The third line makes the chruby program available in the shell. The fourth line will automatically switch the current version of Ruby when you change directories if a hidden file indicates a specific Ruby version. The final line makes Ruby version 4.0.2 the default Ruby in the Terminal.
Save the file. You'll need to run source ~/.zshrc or close and reopen your terminal for the changes to the ~/.zshrc file to be recognized.
Next we'll install Ruby.
Install Ruby
Use the ruby-install utility to list available Ruby versions.
$ ruby-install
Stable ruby versions:
ruby:
3.2.10
3.3.10
3.4.9
4.0.2
jruby:
10.0.4.0
truffleruby:
33.0.1
truffleruby-graalvm:
33.0.1
mruby:
3.4.0
Use ruby-install to install the newest Ruby version.
$ ruby-install --update ruby
Important: After installation, close and re-open the terminal window.
Verify that the newest version of Ruby is installed with ruby -v.
$ ruby -v
If you see Ruby version 2.6.10, it is the system Ruby and you likely forgot to close and re-open the terminal window.
The Uninstall Ruby article explains where Ruby versions are installed and how to remove them.
After installing Ruby, set up your gem environment. See Check Ruby Gems and Bundler.
Continue setting up your Mac
Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.