Categories
Golang

Fixing “Goland: go build -i cause open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied”

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.

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
Using ls -la command to get the user and group to fix go build -i cause open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied
issue.
ls -la

Or, simply, use the id command:

id -un && id -gn
Using id -un && id -gn command to get the user and group to fix go build -i cause open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied
issue.
id -un && id -gn

To get more on the issue, check the following resources:

Follow for Updates

Processing…
Success! You're on the list.

By Kanan Rahimov

Sr. Software Engineer

Leave a Reply