Jekyll command fails with protobuf_c.bundle LoadError on macOS setup

I’m working on creating a GitHub Pages site and ran into an issue during Jekyll setup on my Mac. I installed the required tools including Homebrew, chruby, and Jekyll following the official documentation.

My current setup shows:

  • ruby -v returns ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin18]
  • chruby -V shows chruby: 0.3.9
  • Jekyll installation completed successfully with gem install jekyll

However, whenever I try to run jekyll -v or any Jekyll command, I get this error:

<internal:/Users/myuser/.rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/Users/myuser/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle, 9): no suitable image found. Did find: (LoadError)
/Users/myuser/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle: cannot load 'protobuf_c.bundle' (load command 0x80000034 is unknown)

I’ve tried switching to rvm instead of chruby and tested different Ruby versions like 3.1.3 and 3.2.0, but the same protobuf_c loading error persists. This is my first time working with Ruby and Jekyll, so I’m not sure what’s causing this issue or how to fix it.

Had the same problem last month. Clear your gem cache first with gem cleanup, then reinstall Jekyll from scratch. Old cached gems sometimes mess with protobuf. Also make sure your Xcode command line tools are updated - run xcode-select --install since protobuf needs proper build tools.

This protobuf_c.bundle error happens when your Ruby installation doesn’t match the compiled gem’s architecture. You’re probably hitting Apple Silicon compatibility issues even on Intel Mac.

Here’s what fixed it for me: completely nuke the google-protobuf gem and reinstall with native compilation. First run gem uninstall google-protobuf, then gem install google-protobuf --platform=ruby. The --platform=ruby flag forces it to build from source instead of using precompiled binaries, so it matches your actual system.

If that doesn’t work, you might need to reinstall Ruby itself with a version built for your Mac’s architecture. Sometimes Ruby binaries have weird compatibility issues that only show up with native extensions like protobuf.