Command not found go — on Mac after installing Go

后端 未结 7 2065
逝去的感伤
逝去的感伤 2021-02-03 18:24

I want to use Go, but I\'m having trouble running the go command. I installed go1.5.2 darwin/amd64, but when I run the command go version, I get an error in the ter

7条回答
  •  一向
    一向 (楼主)
    2021-02-03 19:14

    I kept running into issues and followed the steps on here and finally got a working solution: http://totzyuta.github.io/blog/2015/06/21/installing-go-by-homebrew-on-mac-os-x/

    Install w/brew:

    brew install golang
    

    Edit bash_profile and add following paths:

    nano ~/.bash_profile
    
    export GOROOT=/usr/local/opt/go/libexec
    export GOPATH=$HOME/.go
    export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
    

    Source it:

    source ~/.bash_profile

    Then restart terminal

    go version

    Output: go version go1.12 darwin/amd64

提交回复
热议问题