Made a script to install the latest hugo release (non-extended version) on macOS. It works on Ubuntu as well, just replace occurrences of
Edit: This assumes
$HOME/bin/ is already on your
Edit 2: It now does all work in
/tmp/, then moves the hugo binary to
/usr/local/bin/, so this script will likely need need to be run with
# Change to temporary directory pushd /tmp/ # Get JSON response of latest releases, find the one we want, # pretty-up the URL, then download it curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ | grep "browser_download_url.*hugo_[^extended].*_macOS-64bit\.tar\.gz" \ | cut -d ":" -f 2,3 \ | tr -d \" \ | wget -qi - # Unzip hugo binary tarball="$(find . -name "*macOS-64bit.tar.gz")" tar -xzf $tarball # Give hugo binary executable permissions chmod +x hugo # Move hugo binary to a location that is already on your PATH mv hugo /usr/local/bin/ # Go back to previous directory popd # Display hugo binary location and version location="$(which hugo)" echo "Hugo binary location: $location" version="$(hugo version)" echo "Hugo binary version: $version"