Skip to content

Instantly share code, notes, and snippets.

@fscm
Last active March 8, 2022 10:00
Show Gist options
  • Save fscm/6875fe0e5dca25667e3ef3220c40e2a7 to your computer and use it in GitHub Desktop.
Save fscm/6875fe0e5dca25667e3ef3220c40e2a7 to your computer and use it in GitHub Desktop.
[macOS] Install hugo

[macOS] Install hugo

Instructions on how to install the hugo static site generator.

Install (normal version)

hugo can be obtained here. Copy the link for the version that you want to install from there.

Get the hugo archive and extract it with the following command:

curl --silent --location --retry 3 "https://github.com/gohugoio/hugo/releases/download/v0.93.2/hugo_0.93.2_macOS-64bit.tar.gz" | sudo tar xz --no-same-owner --strip-components=0 -C /usr/local/bin/ hugo

To install the latest version use the following commands instead:

hugo_version="$(curl --silent --location --retry 3 'https://api.github.com/repos/gohugoio/hugo/releases/latest' | sed -E -n '/tag_name/ s/.*v([0-9.]+).*",/\1/p')"
curl --silent --location --retry 3 "https://github.com/gohugoio/hugo/releases/download/v${hugo_version}/hugo_${hugo_version}_macOS-64bit.tar.gz" | sudo tar xz --no-same-owner --strip-components=0 -C /usr/local/bin/ hugo

Install (extended version)

hugo can be obtained here. Copy the link for the version that you want to install from there.

Get the hugo archive and extract it with the following command:

curl --silent --location --retry 3 'https://github.com/gohugoio/hugo/releases/download/v0.93.2/hugo_extended_0.93.2_macOS-64bit.tar.gz' | sudo tar xz --no-same-owner --strip-components=0 -C /usr/local/bin/ hugo

To install the latest version use the following commands instead:

hugo_version="$(curl --silent --location --retry 3 'https://api.github.com/repos/gohugoio/hugo/releases/latest' | sed -E -n '/tag_name/ s/.*v([0-9.]+).*",/\1/p')"
curl --silent --location --retry 3 "https://github.com/gohugoio/hugo/releases/download/v${hugo_version}/hugo_extended_${hugo_version}_macOS-64bit.tar.gz" | sudo tar xz --no-same-owner --strip-components=0 -C /usr/local/bin/ hugo

Verify

Run the following command on a terminal window:

hugo version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment