After 2 years of using the NewsRoom theme on Hugo, I wanted to switch themes and use something new. With Bootstrap theme as my ideal choice, I decided to nosedive into migrating over until I was faced with my first blocker… upgrading Hugo to its latest version.
My current Hugo version: 0.61.0
The new theme’s minimum required version: 0.75.0
What could be so interesting about upgrading Hugo that I decided to write a blog post about it? Well, like most SDK upgrades, there’s always more than meets the eye. Thus for Hugo, a seemingly five second version bump quickly spiraled into countless minutes of troubleshooting and debugging.
To upgrade Hugo, I ran brew install hugo
, which inevitably auto-updated my Homebrew version and downloaded the latest Hugo version.
Then, the error about an another version is already linked decided to pop up:
After some research, the error is thrown because homebrew core and task folders are shallow clones:
This might cause a homebrew update if it’s too old. Given the latest changes on GitHub to restrict large repositories from auto-updating shallow clones, you might need to manually update Homebrew and links to the appropriate folders.
After updating, you should run these two commands back to back:
1git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
1git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
The next step is to unlink the existing version of Hugo from homebrew via the following command:
1brew unlink hugo
then link Hugo again so it can point to the latest version:
1brew link hugo
Voila! Now Hugo is successfully updated to its latest version.
Stay tuned for a blog post about migrating themes in Hugo.