升级到Mac OS 10.9.3后,Bash无法识别go命令。

huangapple go评论71阅读模式
英文:

Bash does not recognize go after upgrading to Mac OS 10.9.3

问题

在我升级到Mac OS 10.9.3之前,Go在我的电脑上运行得很好。现在,无论我在一个可接受的位置输入什么go命令,它都会显示“-bash: go: command not found”。

我检查了我的bash_profile,一切都正常。我也成功地使用了source命令。当我执行echo $GOPATH时,它显示的是正确的路径。

有没有人知道如何修复这个问题,而不必完全重新安装golang?

英文:

Go was working fine on my computer before I upgraded to Mac OS 10.9.3. Now, whenever I issue a go command (from an acceptable location), it says "-bash: go: command not found."

I checked my bash_profile, and everything is fine. I sourced it with no issue. When I execute: echo $GOPATH, it is correct.

Does anyone have any idea how to fix this without having to completely reinstall golang?

答案1

得分: 1

你是如何安装Go的?问题不在于GOPATH,而是PATH本身。

如果你是通过brew安装的,请确保在你的$PATH中有/usr/local/bin。如果你是从源代码安装的,你需要将$GOBIN和/或$GOROOT/bin添加到你的$PATH中。

如果你不知道go的位置,你可以运行locate /bin/go(你可能需要在此之前运行sudo /usr/libexec/locate.updatedb来更新locate数据库),然后将该位置添加到你的$PATH中。

英文:

How did you install Go? The issue is not with GOPATH but with PATH itself.

If you installed from brew, make sure you have /usr/local/bin in your $PATH. If you installed from sources, you need to have your $GOBIN and/or $GOROOT/bin in your $PATH.

If you don't know where go is, you can run locate /bin/go (you might want to run sudo /usr/libexec/locate.updatedb before in order to update the locate database.) and add the location in your $PATH

答案2

得分: 0

你试过打开一个新的终端窗口吗?当我使用brew安装东西时,我经常遇到这个问题。

英文:

Lame I know but: Have you tried opening a new terminal window? I frequently have that issue when I install stuff with brew.

huangapple
  • 本文由 发表于 2014年6月23日 05:02:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/24355702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定