Shortest and current solution.
Write this code in Terminal.
export GOPATH=path/to/your/gopath/directory Note: This will reset on every new Terminal window or system restart.
To be persistent, paste the code below in your .zshrc or .bashrc file according to your shell. Those files in your Home Directory. It will be like below.
export PATH=path/to/some/other/place/composer/for/example export GOPATH=path/to/your/gopath/directory export PATH=$PATH:$GOPATH/bin