Can't run Jekyll on Monterey

Hi all,
Since I had problems after updating to Mac OS 12.0.1 I have now done a clean install of the OS and started from fresh. I haven’t made any progress though!

I have followed the instructions on jekyllrb.com to a T and installed ruby and Jekyll.

When I try to run the local server and run a website I created some time ago and which works perfectly from my another computer I get this:

Could not find addressable-2.7.0 in any of the sources
Run `bundle install` to install missing gems.

If I run ‘bundle install’ it does not solve the problem, I get the same error message over and over.
Do I have to be in a specific working directory to run this command?

If I try to create a blog from scratch and follow the steps:

Jekyll new test
cd test
bundle exec Jekyll serve

I get this:

“”
bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll)

/Users/stephane/.local/share/gem/ruby/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/servlet.rb:3:in `require’: cannot load such file – webrick (LoadError)

“”

Does that mean I have a PATH problem? Here’s my PATH variable content in case that helps:

/Users/stephane/.gem/ruby/3.0.0/bin
/usr/local/opt/ruby/bin
/usr/local/lib/ruby/gems/3.0.0/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Thank you for any help you can provide.
Stephane

Hi Stephane. If you’re still having this issue with addressable, could you please show your Gemfile in the project that’s giving you that error?

As for the webrick error when creating a new blog from scratch, that’s a known issue with Jekyll when using Ruby 3.x. You can either use Ruby 2.7.5, or if you want to use Ruby 3.x, you’ll need to add the webrick gem to your Gemfile:

bundle add webrick

It sounds like you are mostly there and yes webrick does tend to be a common problem as @monfresh pointed out, do see if that solves the problem.

Here’s a video I created for new Mac M1 users. You might want to watch it to make sure you didn’t miss anything:

I also put down the steps in this repo (the readme file):

Hope this helps!

This tutorial is very detailed and easy to follow, and I’m sure it works for some machines. Unfortunately, it didn’t work for me, although it seems like it should have.

There is not enough space here to enumerate the problems I’ve had. I have been troubleshooting Homebrew, Ruby, Ruby version managers, and Jekyll installation on Monterey (M1 MacBook) for literally three days with no success. I’ve scoured the web for help, I’ve tried working with my path and environment variables, and I’ve tried using a terminal with Rosetta enabled.

At this point I give up. I have no idea what’s wrong or even what questions to ask. I’ve been working with Jekyll for a long time, and I’ve never been so frustrated.

This is not directed at you. I’m posting this here because it seems like a lot of users are running into problems on Apple Silicon machines. The issue seems to be with Apple more than anything else.

This is very sad. I worked for me after solving some issues. What was like a magic solution for me, several times, crude as it sounds, is simply thrashing the entire gem folder; it gets recreated automatically. Earlier than that: brew doctor, does that help? You know that in in ARM machines brew stuff has been relocated? Hoping the best for your installation, Michael

1 Like

Could you walk through the steps and highlight where things went wrong and some of the issues you encountered? Happy to try and help

1 Like

To correct myself: I deleted not the gem but the gems folder when I had problems.

As it happens, on another machine I was just going through the brew update / upgrade / cleanup / missing steps, and after that on JEKYLL_ENV=production bundle exec jekyll serve I got horrible error messages like

<internal:/opt/homebrew/Cellar/ruby/3.1.1/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/Users/bach/gems/gems/pathname-0.2.0/lib/pathname.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/ruby/lib/libruby.3.0.dylib (LoadError)
  Referenced from: /Users/bach/gems/gems/pathname-0.2.0/lib/pathname.bundle
  Reason: tried: '/opt/homebrew/opt/ruby/lib/libruby.3.0.dylib'… etc etc …

So to eat my own dog food, I simply deleted ~/gem. Then gem update took much longer, of course (>1 min), but finally Jekyll started to serve again, all fine. No need to understand the error in detail :).

Brew used to sit here: /usr/local/Homebrew. I have deleted that, with ARM brew is using /opt/homebrew for all libraries and binaries.

1 Like

Thank you Bill, I appreciate your offer to assist - I want to be mindful of not taking up your time. My troubleshooting was scattershot (lots and lots of web searches over several days). It’s hard to encapsulate but I’ll try.

Just to note: I’m using a zsh terminal (I tried setting my terminal to bash but that didn’t work very well either). I also tried creating an instance of the zsh terminal with Rosetta enabled, with limited success, but only got as far as a successful Brew installation.

Here are some of my issues in a nutshell:

  • Every time I open a new instance of my non-Rosetta enabled zsh terminal, I get “command not found” errors. “Brew” is one example. I tried installing Brew and adding the “echo” and “eval” lines from the instructions in my terminal, but it does not seem to recognize this in a new terminal session. (The Rosetta enabled terminal recognizes Brew.)

  • “Ruby -v” keeps showing me the system installation of Ruby, regardless of the terminal I’m using. The Ruby version that came with my system is 3.0, and I tried installing 3.1.1 and setting it up as the global version. Version 3.1.1 is there but not being recognized.

  • Installing a Ruby version manager did not help. (I tried several.)

  • I have not been successful installing Jekyll at all.

Other notes:

  • There is a chance I messed up my PATH file(s) along the way. I did attempt to reset to default and start over. (I found a tutorial on this.)

  • I also created a .zshrc file, but the terminal doesn’t seem to recognize it.

I am not a command line expert. I can follow directions, but I don’t fully understand what’s happening under the hood. I guess, in a nutshell, if I knew exactly how to configure PATH information on my machine, it would be helpful. Would also help to know how the Apple Silicon machines apply the PATH and 3rd party installations vs. earlier generation MacBooks.

(Not saying that you personally need to add this in your tutorial, but generally it would help to have a comprehensive tutorial with all of this info.)

For example, what does a PATH setup look like for a Jekyll installation on an Apple Silicon machine, and what steps do you follow to edit the PATH file if you need to? I’ve read that you need a zsh profile and a .zshrc file – I don’t understand the difference or how to work with these.

It is very likely that I messed something up along the way, but I’m not enough of an expert to know how to pinpoint it.

I probably need to reset everything and start over, but I don’t know how to do that and don’t want to mess things up further.

If needed, I bookmarked some of the tutorials I followed and can post them here.

This sounds like the path is involved, indeed. I’m also using zsh. Here are resources I’ve kept at the beginning of my path for my own reference:

# from https://support.apple.com/en-gb/HT208050
# .zshrc is equivalent to .bashrc and runs for each new Terminal session
#  (.zprofile is equivalent to .bash_profile and runs at login, including over SSH)

For starters I would use only ONE place to modulate zsh, I chose .zshrc. The Ruby part there is like so:

# Ruby
export PATH="/opt/homebrew/opt/ruby/bin:$PATH" # this is for M1 MacOS
eval "$(/opt/homebrew/bin/brew shellenv)"

Consequently, I get this.

~% which ruby
/opt/homebrew/opt/ruby/bin/ruby

Next for Jekyll plus associated gems:

# gems (for Jekyll)
export GEM_HOME=$HOME/gems
export PATH=$HOME/gems/bin:$PATH

results in:

~% which jekyll
/Users/bach/gems/bin/jekyll

Very useful to check your environment is the terminal command printenv.
Good luck!

Thank you Michael, this did help somewhat (it got me a little bit further and helped with my understanding). I appreciate the info.

Am still not able to successfully install Jekyll, so I switched to another SSG that I was able to install via Brew and get up and running in a few steps. I’m a command line novice on MacOS, which is part of the problem. (I like Jekyll though and still use it on Windows.)