How to fix Jekyll after upgrading to macOS 11 Big Sur

08 Nov 2020

I recently upgraded from MacOS Catalina to Big Sur beta and the first thing I noticed was that my dev environment was broken. My website was setup locally using Jekyll and when I tried to run 'bundle exec jekyll serve', I got this error:

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

And running 'bundle install' didn't seem to solve it (even with sudo), it showed this error:

An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds
before bundling.

Running gem install eventmachine also returns an error, and the mkmf.log file showed an error with ruby:

"xcrun clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.Internal.sdk/usr/local/lib     -lruby.2.6   "
In file included from conftest.c:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
         ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks')
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

package configuration for openssl is not found

And at the time of writing this post, Homebrew doesn't support MacOS 11 Big Sur, so "brew install rbenv ruby-build" doesn't work.

How to fix command line tools (CLT) in MacOS Big Sur:

I did some search online, and found this answer on stack overflow (Which involves installing Xcode 12 beta);

So follow these steps to install rbenv. You need xcode installed for step 4. Also, I updated the steps to match my use case;

  • git clone https://github.com/rbenv/rbenv.git ~/.rbenv
  • cd ~/.rbenv && src/configure && make -C src
  • Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. see: https://github.com/rbenv/rbenv#basic-github-checkout
  • xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
  • Now in your Jekyll project's root, you should be able to run bundle install and it should install all missing dependencies.

Now running bundle exec jekyll serve should start your server.

I hope this helps someone ✌🏾

Get in touch

Connect

Subscribe to my newsletter

Receive updates on my latest interests, projects or any other thing I'm working on.