mac 彻底删除 golang

作者: MZ钟沐 | 来源:发表于2017-05-19 17:32 被阅读2912次

    按照官方解释,root 权限下
    删除

    ➜  ~ rm -rf /usr/local/go
    

    删除

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

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

    ➜  ~ vim ~/.bash_profile
    

    执行完,再查看一下

    ➜  ~ pkgutil --pkgs | grep -i go
    

    显示

    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
    

    相关文章

      网友评论

      • 戈风:既然用brew的话,用brew remove go 不好吗?
        程序猿小明:- - 卸载的是用安装包安装的!不是用homebrew!如果用homebrew安装当然可以直接brew remove!

      本文标题:mac 彻底删除 golang

      本文链接:https://www.haomeiwen.com/subject/pnbyxxtx.html