Updated to Catalina and the Ruby version is wrong

I have updated my mac to use Catalina and now I am having all sorts of issues when I try and install Jekyll.

This is what I get when I run my usual grunt setup:

Running "jekyll:dist" (jekyll) task
>> Error: Command failed: bundle exec jekyll -v
>> bundler: command not found: jekyll
>> Install missing gem executables with `bundle install`
Warning: Please install Jekyll before running this task. Use --force to continue.

I then run sudo bundle install

I then get this:

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Using public_suffix 3.0.1
Using addressable 2.5.2
Using bundler 2.1.4
Using colorator 1.1.0
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201016-30905-1yh2cx1.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile

current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR=" clean

current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:355:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99
    rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
1 error generated.
make: *** [Call.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18 for inspection.
Results logged to

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

In Gemfile:
  jekyll was resolved to 3.4.3, which depends on
    jekyll-sass-converter was resolved to 1.5.1, which depends on
      sass was resolved to 3.5.5, which depends on
        sass-listen was resolved to 4.0.0, which depends on
          rb-inotify was resolved to 0.9.10, which depends on

When I run

ruby -v

I get

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

I have no idea at all what I need to do.

When I run

jekyll -v

I get

-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

I tried running this from another post but had no luck gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"

Does anyone have any ideas?


Try following the macOS installation instructions at: https://jekyllrb.com/docs/installation/macos/

If you want to use Catalina’s built-in Ruby, then you can skip the “Install Ruby” section. Note that it recommends using a local user-based install, rather then using sudo for a global install.

1 Like

I use these steps myself on Catalina and have recommended on another recent post as they worked there. It is based on the Jekyll install docs.

Install a custom 2nd Ruby because system Ruby and gems are locked in Catalina to protect you from yourself I guess.

brew install ruby

That used to get my 2.6 but
Ruby 2.7 is available now on brew so you might get that.

Add the following to your ~/.bashrc and ~/.zshrc file. This will ensure so that your user (Homebrew) install of Ruby will be found before the system Ruby.

export RUBY_HOME=/usr/local/opt/ruby/bin

Add this after the lines above to make sure your PATH in .zshrc or .bashrc includes a path to your user gems, so they can be found when running from anywhere. Replace X.X.0 with your own Ruby version e.g. 2.6.0 (always end with 0 ).

export GEM_PATH="$HOME/.gem/ruby/X.X.0/bin" 

Note your Jekyll error had 2.3 in path. That was Ruby pre-Catalina. So you need to install Jekyll again in the custom ruby installed above.

Install jekyll for your user. Use the flag to avoid sudo .

gem install jekyll --user-local

I recommend you install bundler using the command above as well so you can install Jekyll in each project. If you only use github pages then you’re okay to just use Jekyll 3.9 for your user but otherwise you might use jekyll 4 for some projects and it’s nice switch between Jekyll versions for each project.

1 Like