All posts

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:

shell
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:

shell
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:

shell
"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.

GitHub comment from Homebrew maintainer MikeMcQuaid: sorry folks, we're not here to provide support for Big Sur, you'll have to figure this out yourself until we officially support it. The issue was then locked as off topic.
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;

  1. Clone rbenv into ~/.rbenv:

    bash
    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
  2. Build from source:

    bash
    cd ~/.rbenv && src/configure && make -C src
  3. Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. See: rbenv basic GitHub checkout

  4. Switch to Xcode beta:

    bash
    xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
  5. In your Jekyll project's root, run bundle install to install all missing dependencies.

Now running bundle exec jekyll serve should start your server.

I hope this helps someone ✌🏾