Link Search Menu Expand Document

Install Ruby on your Mac

MacOS comes with a version of Ruby already, but it’s not the version we use for our projects. The following instructions will install the latest version of Ruby on your system. Before you can begin, you need to install Homebrew on your Mac. Return here once you have completed all of the steps on that page.

Install Ruby through Homebrew

brew install ruby

Set Up your Path

It’s important that your Terminal knows where the new version of Ruby is. (These instructions are different than the ones on the Homebrew installation page, so pay attention.) The procedure for this depends on which shell you’re using. You’re probably using zsh, but if you’re unsure which shell you’re using, run echo $SHELL.

If you use Bash, run

echo 'export PATH=${HOME}/brew/opt/ruby/bin:${PATH}'  >> ~/.bash_profile
source ~/.bash_profile

If you use Zsh, run

echo 'export PATH=${HOME}/brew/opt/ruby/bin:${PATH}'  >> ~/.zshrc
source ~/.zshrc

Now that you have Ruby installed, we can test to see if we set up the path correctly. Run this command in your Terminal:

which ruby

You should see something like /Users/ab123456/brew/opt/ruby/bin/ruby (where ab123456 is your NID). If you see a different path, like /usr/bin/ruby, check that you followed the instructions above correctly and completely.