Problems Add the brew ruby path to your shell config

Hi, I am completely new to Jekyll and using terminal in a Mac, so it may sound stupid but when installing ruby when I have to add brew ruby path to your shell config I just copied what it says:

“echo 'export PATH=”/usr/local/opt/ruby/bin:$PATH"’ >> ~/.bash_profile"

and I get this error message:

zsh: permission denied: /Users/fergomez/.bash_profile

and I do not know what to do,
any help is appreciated
FER

Perhaps you made a typo as you’d only get permission denied trying to execute the target file.

From the docs https://jekyllrb.com/docs/installation/macos/

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile

zsh profile is more useful for you

I’d not even bother with profile files and rather go for RC files:

Open ~/.zshrc

Add this line

export PATH="/usr/local/opt/ruby/bin:$PATH"

Hi Michael, thanks for your willingness trying to help. I am not sure I fully understood what to do. You said open /.zshrc and add a line but I do not know where to open it from.
My problem apparently is pretty similar to the one poster here (see link below, does it have anything to do with using the bash or zsh shell?):

Below you have the gem env info in case it helps, again thanks for your time:

RubyGems Environment:

  • RUBYGEMS VERSION: 3.0.3
  • RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin19]
  • INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
  • USER INSTALLATION DIRECTORY: /Users/fergomez/.gem/ruby/2.6.0
  • RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • SPEC CACHE DIRECTORY: /Users/fergomez/.gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  • RUBYGEMS PLATFORMS:
    • ruby
    • universal-darwin-19
  • GEM PATHS:
    • /Library/Ruby/Gems/2.6.0
    • /Users/fergomez/.gem/ruby/2.6.0
    • /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
  • SHELL PATH:
    • /opt/anaconda3/bin
    • /opt/anaconda3/condabin
    • /usr/local/bin
    • /usr/bin
    • /bin
    • /usr/sbin
    • /sbin

Use this

nano ~/.zshrc

Or replace nano with vim. Or code if you use vscode

That link is related but that might not be needed as there is a lot of detail there.

If you use ZSH then add the line to .zshrc

If you use Bash add it to .bashrc instead

Or add it to both