# Adding Ruby and Brew paths

**URL:** <https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088>\
**Category:** Help\
**Created:** [May 27, 2021, 6:46pm UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088 "2021-05-27T18:46:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BillRaymond](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/billraymond/32/5963_2.png) [@BillRaymond](https://talk.jekyllrb.com/u/BillRaymond)\
**Post date:** [May 27, 2021, 6:46pm UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/1 "2021-05-27T18:46:40Z")

</div>

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:

> **[Jekyll on macOS](https://jekyllrb.com/docs/installation/macos/)**
>
> Install Command Line Tools To install the command line tools to compile native extensions, open a terminal and run:

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:

```auto
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:

```auto
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?

Thanks!

---

<div class="post-metadata">

**Author:** ![TerminalAddict](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/terminaladdict/32/1300_2.png) [@TerminalAddict](https://talk.jekyllrb.com/u/TerminalAddict)\
**Post date:** [May 27, 2021, 7:38pm UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/2 "2021-05-27T19:38:01Z")

</div>

The difference is simply where to find your gems.

I have them in my home dir.

> **[Jekyll Getting Started](https://terminaladdict.com/linux/jekyll/bash/development/2018/10/17/Jekyll-Getting-Started.html)**
>
> So my web development has taken an interesting path, not that different to some others.I start back in 1907 doing hand coded html, then moved to hand coded php, then dreamweaver, then CMS.Eventually making it to Wordpress then back to PHP, and now to...

---

<div class="post-metadata">

**Author:** ![TerminalAddict](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/terminaladdict/32/1300_2.png) [@TerminalAddict](https://talk.jekyllrb.com/u/TerminalAddict)\
**Post date:** [May 27, 2021, 7:38pm UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/3 "2021-05-27T19:38:59Z")

</div>

[![](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/c/cf2cfa9faf780d942b1af8c3d073e566d16f6ba3.jpeg "Jekyll Getting Started with bootstrap and jquery") ](https://www.youtube.com/watch?v=96gESBDFzco)

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [May 28, 2021, 7:19am UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/4 "2021-05-28T07:19:29Z")

</div>

> [@BillRaymond](#):
>
> ```auto
> If you need to have ruby first in your PATH, run:
> echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
> 
> ```

That is about path to Ruby itself.

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

> [@BillRaymond](#):
>
> `echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.zshrc`

If you go with

```auto
/usr/local/lib/ruby/gems/3.0.0/bin

```

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

Or

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

---

<div class="post-metadata">

**Author:** ![BillRaymond](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/billraymond/32/5963_2.png) [@BillRaymond](https://talk.jekyllrb.com/u/BillRaymond)\
**Post date:** [May 28, 2021, 10:39pm UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/5 "2021-05-28T22:39:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [May 29, 2021, 6:55am UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/6 "2021-05-29T06:55:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BillRaymond](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/billraymond/32/5963_2.png) [@BillRaymond](https://talk.jekyllrb.com/u/BillRaymond)\
**Post date:** [May 29, 2021, 8:43am UTC](https://talk.jekyllrb.com/t/adding-ruby-and-brew-paths/6088/7 "2021-05-29T08:43:28Z")

</div>

Okay, thank you very much, as always!
