Collect from 网页模板
Modified by 追梦人物

mac 彻底删除 golang

按照官方解释,root 权限下

删除

➜  ~ rm -rf /usr/local/go

将环境变量,有关 go 的删了即可

执行完,再查看一下

➜  ~ rm -rf /etc/paths.d/go

显示

➜  ~ vim ~/.bash\_profile

如此应该可以用

安装最新版本的了吧,但是
抱歉,不行,提示

➜  ~ pkgutil --pkgs | grep -i go

昨天从装 go 1.8.1 到今天卸载,内心无比崩溃

继续看一下哪里还有

com.google.sketchup8.sketchup.application
com.google.sketchup8.sketchup.support
com.googlecode.go

如此应该可以用

➜  ~ brew install go

安装最新版本的了吧,但是 抱歉,不行,提示

Warning: go-1.8.1 already installed

昨天从装 go 1.8.1 到今天卸载,内心无比崩溃

继续看一下哪里还有

➜  ~ which go
/usr/local/bin/go
➜  ~ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xxx/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8.1/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/12/qpph2f511xq_hbw9hn8nkq4h0000gn/T/go-build576628875=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
➜  bin cd /usr/local/Cellar
➜  Cellar ls
ant            gettext        icu4c          kubernetes-cli libpng         openssl        readline       unixodbc
freetype       go             jpeg           libevent       libxml2        php71          tmux           wget
➜  Cellar cd go
➜  go ls
1.8.1
➜  go cd ..
➜  Cellar ls
ant            gettext        icu4c          kubernetes-cli libpng         openssl        readline       unixodbc
freetype       go             jpeg           libevent       libxml2        php71          tmux           wget
➜  Cellar rm -rf go
➜  Cellar which go
go not found
➜  Cellar cd /
➜  / which go
go not found
➜  / go
zsh: command not found: go

重新安装 go

➜  / brew install go

原文链接:https://www.jianshu.com/p/2165567cd5ef