直观图
进入终端:
1、install homebrew
2、brew install go
安装成功路径:/usr/local/Cellar/go/1.9
或者翻墙:
成功后,执行 go env:
GOARCH="amd64"
GOBIN="/usr/local/Cellar/go/1.9/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/Cellar/go/1.9"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jr/4qxykhq90qg9vgh2s0sjmmhr0000gp/T/go-build898226147=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
环境配置:
终端:vim ~/.bash_profile
export GOPATH=/usr/local/Cellar/go/1.9
export PATH=$PATH:$GOPATH/bin
export GOBIN=/usr/local/Cellar/go/1.9/bin
export PATH=$PATH:$GOBIN
export GOROOT=/usr/local/Cellar/go/1.9/libexec
export PATH=$PATH:$GOROOT/bin
终端:echo $PATH
/usr/local/Cellar/go/1.9/bin:/usr/local/Cellar/go/1.9/bin:/Users/zuodongdong/protoc-3/bin:/usr/local/Cellar/go/1.9/libexec/bin
安装完成,尽情的开发吧!