英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论