Goland as well as Go’s build sometimes throws the following issue: go build -i cause open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied
. The solution to this issue is easier than it seems – we need to fix some directory permissions issues.
For me it was the following command:
sudo chown -R kananrahimov:staff /usr/local/go
This command will change the owner user and group for the go
directory.
kananrahimov:staff
is my system user and group. You can find it for yourself by using the following command:
ls -la

Or, simply, use the id
command:
id -un && id -gn

To get more on the issue, check the following resources:
- https://github.com/golang/go/issues/37962
- https://stackoverflow.com/questions/60771344/go-build-i-cause-open-usr-local-go-pkg-darwin-amd64-runtime-cgo-a-permission
Follow for Updates
Processing…
Success! You're on the list.
Whoops! There was an error and we couldn't process your subscription. Please reload the page and try again.