Jekyll crashes on macOS Monterey

Today I went to use Jekyll for the first time since upgrading from macOS Big Sur to macOS Monterey (Intel iMac, not M1), and started receiving some strange errors. At the current moment, simply running the command jekyll without any arguments, in any directory, gives the following output:

➜  ~ jekyll
<internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- forwardable/extended (LoadError)
Did you mean?  forwardable/impl
	from <internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/malcolmanderson/.gem/ruby/3.0.0/gems/pathutil-0.16.2/lib/pathutil.rb:6:in `<top (required)>'
	from <internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/malcolmanderson/.gem/ruby/3.0.0/gems/jekyll-4.2.1/lib/jekyll.rb:32:in `<top (required)>'
	from <internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/malcolmanderson/.gem/ruby/3.0.0/gems/jekyll-4.2.1/exe/jekyll:8:in `<top (required)>'
	from /Users/malcolmanderson/.gem/ruby/3.0.0/bin/jekyll:25:in `load'
	from /Users/malcolmanderson/.gem/ruby/3.0.0/bin/jekyll:25:in `<main>'

I’ve uninstalled and reinstalled Ruby more times than I can count now, using both Homebrew and rbenv. I’ve run gem update --system and bundle update ffi as the Troubleshooting page suggests, but to no avail.

Version of Ruby I’m running:

➜  ~ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin21]

(Installed via Homebrew)

Might anyone know how I can solve this issue? If necessary, I’m happy to provide more information.

Thanks!

Someone suggested that I use the command

bundle config set --local path 'vendor/bundle'

to create a virtual environment for my project, then run bundle install to install the dependencies there, and finally use bundle exec jekyll serve to actually serve the website. This worked for me!

However, running jekyll in any other directory still gives the same error. At this point, since I’ve got Jekyll working for my site, I’m more-or-less happy, but if this is an issue others would like to investigate further I can still provide more info.