Blau's Blog

A furry blog covering various topics including gaming, Second Life, and misc tech.


Oops, I broke Ruby

Date: []
Categories: [Computers], [I Broke It (Then Fixed It)]
Tags: [ruby], [jekyll]

This post has been copied over from my old blog.

Right now, all I use Ruby for is to run Jekyll (and Bundler). I don't really have any other uses for it, though learning how to use Ruby is on my long-term to-do list, even if just enough to be able to read it.

I found out recently (though a Github dependabot email) that some of the dependencies for my Jekyll install were found to have a few vulnerabilities, so I tried bundle update. Didn't really install anything new, didn't really update very much, and the issue persisted. Actually, it got worse: A dependency refused to install entirely. Realized then that I hadn't updated Ruby itself in quite a while (since I installed it last year), and figured that's probably an issue; there might be newer gem releases, they just can't run on my current Ruby version.

Updating Ruby should be a straightforward thing - use your package manager to grab the updated version. However, I am on Windows1. While Windows does have a package manager, it's not useful here. I'm actually pretty certain I've only ever used it to update Powershell.

There are a few ways to get Ruby running on Windows. The two I've messed with are RubyInstaller and using the Chocolatey package manager.

Given I installed Ruby a year ago, and I'm not exactly known for my memory capacity... I genuinely forgot which one I used. But, I apparently had Chocolatey installed, and I can't think of anything else I would have used Chocolatey for, so I assumed that's the installation route I took. I ran choco install ruby and let it do its thing.

And then... everything exploded. Trying to run anything in Jekyll or Bundler gave me a wall of Ruby errors, mainly boiling down to that it couldn't create a Makefile "due to some reason", which is one of my all-time favorite vague error messages. The one thing it did point out is that if an updated Ruby version is compiled in a different way than the initial Ruby install, that error can happen. Doing some searches to try and diagnose the issue, several folks pointed out in addition that something catastrophically wrong might have happened during the install itself, because Ruby should have write access to its own folders, and if it doesn't, something is extremely broken.

In my case, it turns out that I didn't use Chocolatey to install Ruby the first time around (why do I have it installed then? Did I try to install through Chocolatey, fail, and just not clean up? It is a mystery), I used RubyInstaller, and trying to update through Chocolatey tried to install a Ruby version that was compiled in a different way, which led to Ruby not being able to figure out how to use its own directories. At least, that's how I understand it.

I fixed the issue by just entirely dumping all of the Ruby folders I could find2 and reinstalling through RubyInstaller. This meant I basically had to reinstall Jekyll, but thankfully, since the configuration isn't stored in the gems, it's stored in the gemfile for my site, and my site is not stored in the Ruby install folders, nothing was lost.

As part of reinstalling Jekyll, I ran bundle install to grab all of the gems from my Gemfile and their dependencies. Bundler made it most of the way through, then ran into another Ruby error. This time, it "failed to build native extension". I... well, at least now I know it's probably not my install, I guess?

Jekyll on Windows uses the wdm (Windows Directory Monitor) gem to monitor for directory changes in Windows. Specifically, Jekyll uses this for the --watch switch is enabled on build or serve. Whenever it detects a file has changed in the directory for your site, it'll automatically rebuild the site so you can see this change immediately (you can use --livereload to make it refresh your browser for you too).

Jekyll's default version for wdm is 0.1.1. Very recently (3 weeks ago as of this post) wdm released version 0.2.0. Included in this update are a few fixes towards newer Ruby versions - this tells me that my current version of wdm might be having issues because of the (comparatively) very new Ruby version I just installed.

Thankfully, this was an easy fix: changed the required wdm version in my Gemfile from 0.1.1 to 0.2.0 and re-ran bundle install. wdm updated itself and did not throw any more errors. Jekyll does not seem to have any issues with this new version as far as I can see - everything serves and builds just fine.

Now, hopefully, no more Ruby or gem nonsense for a little while! (I should also schedule something to remind me to check for new Ruby releases more often than yearly...)


  1. I could be running this under WSL actually, which tbh would probably save me a lot of annoyance given how many things I run into are Linux-only. I just worry then that I'd run into the end-of-line issue with Linux/Windows and Git again. (I'll try to remember to make a post about that one later.) 

  2. Part of this was uninstalling as you would normally uninstall a program and the rest was seek and destroying the various Ruby root folders in my C drive. I don't know if I really had to do that or not but I didn't want to leave a non-working install laying around in case it interfered with the working one.