Command not found go — on Mac after installing Go

后端 未结 7 2172
逝去的感伤
逝去的感伤 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:02

    In my case I was not having ~/.zshrc profile file. Followed below steps to make it work.

    Mac os version : Mojave (10.14.6)

    Go version : go1.13.1 darwin/amd64

    Reference link : https://www.cyberciti.biz/faq/installing-go-programming-language-on-mac-os-x/

    As mentioned in link, when i was executing "go env" command, it was throwing error "go command not found". Adding "export PATH=$PATH:/usr/local/go/bin" in "~/.bashrc" profile file didn't do any magic!!

    step 1 : Create .zshrc profile under home path.

    $ cd /User/xxxx (Eg : /User/tapan)

    $ touch .zshrc

    step 2 : append 'PATH' with go in .zshrc file.

    $ vim .zshrc

    $ export PATH=$PATH:/usr/local/go/bin

    step 3 : source your .zshrc file

    $ source ~/.zshrc

    step 4 : execute "go env" command, you should be able to see local environment details.

    $ go env

提交回复
热议问题