I have installed GO on my Mac Book using the 10.8+ installer from golang.org, and I have set up a workspace. After running both these commands: export GOPATH=$HOME/go
and export PATH=$PATH:$GOPATH/bin
, echoing the GOPATH does return a value of /Users/dipen/go
; however, after restarting the terminal, the echoing the GOPATH returns nothing. How can I fix this?
Asked
Active
Viewed 1,948 times
1

Dipen
- 536
- 2
- 5
- 13
-
You need to put these commands into your `.bash_profile` on OSX . – Intermernet Jan 18 '15 at 01:32
-
possible duplicate of [Cannot set $GOPATH on Mac OSX](http://stackoverflow.com/questions/21499337/cannot-set-gopath-on-mac-osx) – Jeremiah Winsley Jan 18 '15 at 01:43
-
@Intermernet Thanks it worked, I added those exact files and restarted the terminal. – Dipen Jan 18 '15 at 02:05
-
@Dipen good to hear. Happy coding :-) – Intermernet Jan 18 '15 at 02:07
1 Answers
2
Add these lines to your ~/.bashrc or ~/.bash_profile:
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

jgritty
- 11,660
- 3
- 38
- 60
-
Ok. I do same way oh my macbook. Also I have VPS running Ubuntu 14 which I access via SSH only for sure. Due to interactive non interactive shell distinction ~/.bashrc not always sourced. Which profile or rc guaranteed to be sourced on Ubuntu in all case? – Uvelichitel Jan 18 '15 at 11:03
-
That's probably worthy of a separate question, and might already have an answer here. – jgritty Jan 18 '15 at 11:15