mac下Homebrew安装Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed报错解决方法

查了很多资料,只有这篇有用,解决办法请参考这里 https://blog.csdn.net/Jiangzhiqi4551/article/details/116174524

使用brew install go安装完成以后,在home brew命令行执行go version遇到报错:

go: cannot find GOROOT directory: /opt/homebrew/bin/go

解决方法:

export GOROOT="$(brew --prefix golang)/libexec" 参考这里 https://stackoverflow.com/questions/60406755/cannot-do-any-go-command-anymore

Mac默认使用的shell是zsh,导出的GOROOT环境变量想要在重新打开shell时也生效,需要把export GOROOT="$(brew --prefix golang)/libexec"添加到~/.zshrc配置文件里,然后再执行

source ~/.bash_profile生效,这样当你打开新的shell执行go version时就不会报错了。

  

 
 
posted @ 2023-03-12 18:24  jamstack  阅读(344)  评论(0编辑  收藏  举报