Adding Ruby and Brew paths

I am creating a video that shows how to set up the dev environment for Jekyll. I am using the official Jekyll documentation as a reference, which is located here:

As per the Jekyll documentation, you need to type the following command (there’s a different one for BASH). I believe that I used the following command when I originally set up my dev environment as well:

echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.zshrc

However, when you install Homebrew and then install the latest version of Ruby with brew install ruby, Brew performs the Ruby installation, and once complete, there is a message that looks like this:

If you need to have ruby first in your PATH, run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

My question is, should you do one or both of these commands? If just one, is it the Jekyll recommended line or the Brew/Ruby recommended line?


The difference is simply where to find your gems.

I have them in my home dir.

That is about path to Ruby itself.

And this has both path to Ruby itself and then path to Ruby gems.

If you go with


Then you will load gems install with sudo gem install GEM or gem install GEM but with root giving access to all users to install to /usr/lib


$HOME/.gem/... which is the default if you install with gem install GEM --user-install

I’m really sorry. I appreciate your both helping me. I know so little about Ruby and all my external reading about these paths seems to expect the reader to know a lot more than I do (I’m using Ruby to use Jekyll, not to use Ruby).

Maybe I could ask the question differently: are the Ruby docs correct, is my method correct, or are both correct?

Please keep in mind this is purely for the purposes of developing Jekyll locally, not for coding in Ruby.

Thanks and I hope my question makes sense.

The Jekyll docs are correct. Use that one and don’t do both (since part of the logic is duplicated. note the start of the parts are identical).

If you follow the Brew help you’ll only have Ruby itself accessible.

If you follow the Jekyll docs, you’ll have access to run custom Ruby and be able to run custom gems that you install.

The custom Ruby has a custom gem location. Both are separate from the system Ruby and system gems (which are frozen from Catalina). So you need to tell the shell about both paths so you can use Ruby correctly, whether for Jekyll or plain Ruby.

Okay, thank you very much, as always!

1 Like