go install: no install location for directory outside GOPATH on macOS

If you are trying to install packages using dep from gopkg.toml or update your gopkg.lock with new dependencies on macOS, you may come across this error…

go install: no install location for directory /Users/somebody/project outside GOPATH

Your environment may not have GOPATH or GOBIN set, in which case as a simple solution you can set them relative to your home directory.

(more advanced use-cases will require them to be set differently of course)

Add comment