-
-
Save maurobaraldi/37451005f1ef7cbb8d70e43f0b2c9e5a to your computer and use it in GitHub Desktop.
Install Go on M1/M2/M3 mac (apple silicon)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# find filename on https://go.dev/dl/ | |
GO_FILE_NAME="go1.19.3.darwin-arm64.tar.gz" | |
# usage: | |
# chmod u+x install_go.sh | |
# sudo ./install_go.sh | |
mkdir /tmp/downloads | |
sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads | |
sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME | |
echo 'export GOROOT="/usr/local/go"' >> $HOME/.zshrc | |
echo 'export GOPATH="$HOME/dev/go"' >> $HOME/.zshrc | |
echo 'export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"' >> $HOME/.zshrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Find filename on https://go.dev/dl/ | |
GO_FILE_NAME="go1.21.0.darwin-arm64.tar.gz" # M1 Apple Silicon | |
# Usage: | |
# chmod u+x update_go.sh | |
# sudo ./update_go.sh | |
# | |
# If something goes wrong, just restore the backup: | |
# mv /usr/local/_go_old /usr/local/go | |
# | |
# If everything is ok, then you can remove the backup: | |
# sudo rm -rf /usr/local/_go_old | |
sudo mv /usr/local/go /usr/local/_go_old | |
mkdir /tmp/downloads | |
sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads | |
sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME | |
go version | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment