-
Couldn't load subscription status.
- Fork 8
Running different versions of Hugo from command line (sans Homebrew) using zsh
At my day job, I have to run a different version of Hugo depending on the project.
If you need to run different versions of Hugo, I highly recommend this approach; if you need to run an older version of Hugo, and/or you need to run multiple Hugo versions, using Homebrew will mess you up for when it comes to updates.
Download desired Hugo releases from here: gohugoio / hugo: releases
Extract the executable from the release package and put somewhere convenient, like: ~/scripts.
Rename the executables to something easy to remember, for example:

Optional: Run ln -s hugo67e hugo so you have a default hugo command.
In my .zshrc, I have:
# Executables:
path+=("$HOME/scripts")Once that’s all setup, you can run: source "$HOME/.zprofile"
Bonus! Here’s a function that’s handy:
# Reloads session:
function reload() {
source "$HOME/.zprofile"
}Now, you can use hugo serve or hugo54 serve.