I have installed go-lang on my MacBook M2 Pro to compile hugo from the source code.
- Download
Site: https://go.dev/dl
Current: https://go.dev/dl/go1.22.1.darwin-arm64.tar.gz
- Install
cd Downloads
curl -OJL https://go.dev/dl/go1.22.1.darwin-arm64.tar.gz
tar xf go1.22.1.darwin-amd64.tar.gz
sudo mv go /usr/local
echo 'export PATH=/usr/local/go/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
- Configure Local Folders
- GOPATH: The folder to manage packages.
- GOBIN: The folder to locate the package binary.
mkdir ~/.local/go
echo 'export GOPATH=~/.local/go' >> ~/.zshrc
echo 'export GOBIN=~/.local/bin' >> ~/.zshrc
source ~/.zshrc