From 4a34355c3b58480ba888d984e8f138017869ee5b Mon Sep 17 00:00:00 2001 From: Aaron Culich Date: Sun, 22 Sep 2024 20:37:52 -0700 Subject: [PATCH] Fix GOROOT path for Apple Silicon Macs in setup instructions The previous instructions incorrectly set GOROOT to '/opt/homebrew/bin/go', which points to the Go binary rather than the Go root directory. This caused errors when running Go commands on Apple Silicon-based Macs. I updated the instructions to dynamically determine the correct GOROOT path using Homebrew, ensuring compatibility across different environments. This change resolves the 'go: cannot find GOROOT directory' issue on M1/M2 Macs. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf57590..c26d5f1 100644 --- a/README.md +++ b/README.md @@ -137,9 +137,9 @@ export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH for Apple Silicon based macs ```bash # Golang environment variables -export GOROOT=/opt/homebrew/bin/go +export GOROOT=$(brew --prefix go)/libexec export GOPATH=$HOME/go -export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH: +export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH ``` ### Setup