Subscribe for updates and more.

Catalina and Ruby

Planted 02020-07-19

Running Jekyll on macOS Catalina

When I first updated my 2018 MacBook Pro, I had problems—as is due is course when installing ruby.

After upgrading a 2012 MacBook Pro, I had to deal with the same problems so I thought to rehash these notes.

I use Jekyll to build this site, and Jekyll runs on Ruby. To build the site locally I run bundle exec jekyll serve.

Console would log errors like:

`bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory`
`Could not find 'bundler' (2.1.4) required by your Gemfile.lock`
`To install the missing version, run 'gem install bundler:2.1.4'`

So I run gem install bundler:2.1.4

And it logs,

`You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.`

Haaaa. Okay what now?

I noticed new percentage signs in the macOS terminal. It turns out Apple changed the default shell from bash to zsh. I’m not knowledgable enough to really know what that means but if you are interested I’ve linked an article about it.

Because of this change, you have to rename your configuration files.

Bash things are now zsh things.

.bashrc is now .zshrc and .bash_profile is now .zprofile.

So first we need to install Ruby. brew install ruby

Then find which ruby

If it shows /usr/bin/ruby then run

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

And then run which ruby again.

It should be something other than /usr/bin/ruby now.

gem install bundler

No errors, everything works again.

As of writing the Jekyll docs are still for bash shells.