I switched to static website generation with Jekyll in 2019 (probably because of Carl Schwan, who is somehow my guiding-spirit in webulous things even if he does Hugo things nowadays). That means Ruby, and I’ve got various bits-and-notes documents saying things like “When Ruby breaks again, …” This blog post is my attempt to document for myself, once-and-for-all, my setup.

Basically, this comes down to (gently) fighting the FreeBSD packaging system.

Ruby 3.3 Incompatible

With Jekyll 4.3.1, trying to run it with Ruby 3.3 leads to the following error message:

jekyll 4.3.1 | Error:  undefined method `[]' for nil
/usr/local/lib/ruby/3.3/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
        from ~/.gem/ruby/3.3/gems/jekyll-4.3.1/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'

This is documented in the release notes for Jekyll 4.3.3.

Upgrade Blockers

So let’s stick with Ruby 3.2 for a bit. On FreeBSD, that means setting a default version for Ruby in /etc/make.conf, like so:

DEFAULT_VERSIONS+=ruby=3.2

Then installing Ruby 3.2, e.g. with pkg install ruby32. Even though the language is still there, other tools like bundler are not, so I had to build sysutils/rubygem-bundler from ports. Once that’s done, managing my Ruby 3.2 environment is workable again.

This is part of the “gently fighting”: getting the versions of the tools to match the version of the language I want. I can’t really blame the central package-repository for not supporting every use-case.

Upgrading Jekyll seems like the right thing to do, and bundle update is the tool to use. It fails with a peculiar message that suggests that some non-FreeBSD executable is being used:

Installing sass-embedded 1.89.2 with native extensions
ELF binary type "0" not known.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Looking into ~/.gem/ruby/3.2/gems/sass-embedded-1.89.2/ there is an ext/sass directory, which contains an ELF executable called true and a file with ^A in its name (control-A, ASCII 0x01). I have no idea what is going on, but it feels like malware delivery while it is probably some developer delivering Linux tools – the readme mentions a Dart-language tool. I don’t feel like installing the Linuxolator to build this one gem today.

Careful With That Axe

This works remarkably well, once Ruby 3.2 and corresponding bundler are installed:

rm -rf ~/.gem
# Edit gemfile to make BUNDLED WITH match current bundler version
bundle install

I have no use for, or patience with, Ruby other than generate-my-damn-website. This will tide me though until such a time as I update to a slightly-more-modern static site generator, or freeze the whole thing into a virtual-machine image that will never change again because .. it’s a static site generator. I could replace it with vi and some patience.