mac 安装 go1.8.1

使用 homebrew 安装

➜  ~ brew install go
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).
No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/go-1.8.1.el_capitan.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/go-1.8.1.el_capitan.bottle.tar.gz
==> Pouring go-1.8.1.el_capitan.bottle.tar.gz
Warning: This keg was marked linked already, continuing anyway
==> Using the sandbox
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
  export PATH=$PATH:/usr/local/opt/go/libexec/bin
==> Summary
  /usr/local/Cellar/go/1.8.1: 7,030 files, 281.8MB

添加环境变量

➜  ~ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
➜  ~ vim ~/.bash_profile
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
#export PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH=$PATH:/usr/local/opt/go/libexec/bin
➜  ~ source ~/.bash_profile
➜  ~ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/go/libexec/bin

我将原来的 PATH 注释掉了

你可能感兴趣的:(mac 安装 go1.8.1)