Prerequisites for installing Hugo are:

  • GO
  • Homebrew

Here are the steps to install them:

1. Installing GO

Find The Latest GO Version

Visit https://go.dev/dl/

As of this writing, go1.22.0 is the latest version. Change the version number accordingly.

Right click and copy the link address for go1.22.0.linux-amd64.tar.gz or the most recent version for the Linux x86-64 version of GO.

Run these commands. Adjust the go version number in the second and third lines so they reflect the latest filename.

cd /tmp
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -xvf go1.22.0.linux-amd64.tar.gz
sudo mv go /usr/local

Modify your .bashrc file

These commands will make GO accessible to your bash shell.

echo -e "\nexport GOROOT=/usr/local/go\nexport GOPATH=\$HOME/go\nexport PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH" >> ~/.bashrc

Refresh your terminal using bash command

bash

Check Go Version

go version

2. Installing Homebrew

Homebrew is a software tool designed for Linux systems that helps manage packages. Although it is technically possible to install the latest version of Hugo without using Homebrew, I have personally found using Homebrew to be the simplest method for obtaining the most recent version. It is worth noting that the Apt package manager, which is commonly used on Linux systems, does not install the latest Hugo release.

Execute the following command to install Homebrew

Further details can be found on the Homebrew website.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Next steps:

At the end of the install you will see a few commands you need to run.

The commands are under the label "==> Next steps:".


3. Installing Hugo

With brew installed, you can simply type this command to install Hugo.

brew install hugo

You can check the version with:

hugo version