This is a creation in Article, where the information may have evolved or changed.
Read a lot of people on the Internet on the MAC configuration go article, the feeling is not clear, since the record of their installation configuration of the whole process, so as to avoid detours.
Go Official homepage English version, not used to see English, please hit the Chinese version. Under document there is the official install Go guide, point download Go will appear each version, mac10.9 Select both of these can be, just. tar.gz is a compressed file installation package, want to save the download pkg, a fool next on the line.
PKG is installed to/usr/local/go by default
The installation section is done, and the next step is to configure the environment variables under Mac. This is the most critical.
Open the terminal (Terminal) and click on the code:
CD ~ #进入当前用户下的根目录
Ls-a #-A to display hidden files, you may see a. bash_profile file if you do not create it yourself (not on my computer)
Vim. Bash_profile #创建很简单
After entering Vim, press A to edit and enter the code:
Export Goroot=/usr/local/go
Export Path=/usr/local/go/bin: $PATH
Export gopath= where you normally place the Go code
Explain what it means:
Goroot is the PKG package default installation to the place, from the official website can also be seen, the default is installed to/usr/local/go
Path is important, the system comes with the source code to run must have this path, the default installation path when the/usr/local/go/bin
Gopath can be a favorite place for users to put their own written go program
At this point, the. bash_profile file is written, press ESC, typing: WQ, enter, done.
After returning to the terminal, enter source. bash_profile Make edits effective
Verify that the path configuration is successful: Echo $GOROOT, you can see the/usr/local/go.
If you don't see it, restart Ternimal.
The environment variable configuration is complete.
Finish
The next article explains how to configure the Go environment in sublime Text3