c00m1g
Last Updated: February 25, 2016
·
3.195K
· infiniteloop5
Shot 1285609149 small

Set $GOROOT variable with homebrew

If you are using go with homebrew on OSX, add this to your ~/.profile to set the $GOPATH automagically:

GOVERSION=$(brew list go | head -n 1 | cut -d '/' -f 6)
export GOROOT=$(brew --prefix)/Cellar/go/$GOVERSION/libexec
  • Update:

Added libexec, as suggested by @solidfox in the comments.

  • Update 2:

Setting the GOROOT variable should not be necessary in newer versions of go. If you really want to, use:

export GOROOT=$(go env GOROOT)
Say Thanks
Respond

4 Responses
Add your response

15121
124981dedb855069dabef0673e0988ef

Beautiful thanks!

over 1 year ago ·
15654
Qozifs 4 normal

Finally! Thanks

over 1 year ago ·
16445
A5acdd9559e80d623915d533dd85a711

Seems to work better with /libexec at the end. Is it wise to add this?

over 1 year ago ·
18079
None

I second @solidfox's comment. libexec needed.

over 1 year ago ·