macos - 安装 Homebrew 后,我得到 `zsh: command not found: brew`

标签 macos terminal homebrew zsh

➜  ~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-e:77: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040677
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin CODEOFCONDUCT.md etc git lib Library LICENSE.txt munki README.md sbin share .git .github .gitignore
➜  ~ brew install maven
zsh: command not found: brew

最佳答案

我在 macOS Big Sur (11.0.1) 上遇到了类似的问题。就我而言, Homebrew 程序保存在 /opt/homebrew/ 中,而不是 /usr/local/... 中。

所以我添加了

导出 PATH=/opt/homebrew/bin:$PATH

到我的主目录中的.zshrc文件,ZSH shell能够找到brew命令。

关于macos - 安装 Homebrew 后,我得到 `zsh: command not found: brew`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36657321/

相关文章:

macos - 视网膜屏幕上的 IKImageBrowserView

python - 导入pygame时出错

macos - 是否可以使用键盘快捷键在OSX Terminal.app中选择特定选项卡?

bash - MAC 10.10 优胜美地 - 终端 : - bash: [SomeCommand] command not found?

macos - 如何用一行运行多个 brew 命令?

node.js - 找不到 Node gyp

objective-c - NSMutableDictionary 不会追加

mysql - Homebrew Mariadb Mysql 安装 root 访问被拒绝

php - 如何在 Mac OS X 10.6.6 上启用 php-gmp? (没有macports)

c++ - 在调试器内的 OS X 上启动 C++ 命令行工具的简单方法