A little while ago, Hugo released version 0.132.2. This is just a bug fix update, but I like work on the latest version, so I went to update, well, I tried.
A Late Brew
New Hugo versions usually hit brew within a few hours. But, over a day later, it didn’t. This was mildly annoying, as I like to be in step with my GitHub workflows, and I didn’t feel like downgrading those back to what was on my mac. So I decided to adapt a script on my Raspberry Pi 5, to work on my Mac.
From Pi To Mac
The lasted version of Hugo in the PiOS repo, is pretty old. Like, my site won’t build with it old. So I wrote a script to download the latest Hugo deb, and install it.
Adapting this script to macOS took some modifications. The macOS Hugo version, is a binary blob, so I had to strip the apt and dpkg stuff1. I didn’t want a Hugo bin in my site directory, so I made a folder at /opt/user/bin
, where I can toss Hugo, and my script. That finished script looks a bit like this.
#!/bin/bash
echo "Provide version number EG 0.128.2"
read HVer
wget wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v$HVer/hugo_extended_$HVer\_darwin-universal.tar.gz
tar xzf hugo.tar.gz
mv hugo /opt/user/bin
rm LICENSE README.md hugo.tar.gz
I then added that folder to my fish path, so I can run whatever’s in there, from anywhere.
Now, any time a new Hugo version drops, I can just run hugo-update
, type in the version number, and boom, I have the latest version. No waiting for package managers.
-
I had to do that anyway, but you get the point. ↩︎