➜  ~ /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

当前回答

它帮助我。只需运行follow命令:

echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/gureenkov56/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/gureenkov56/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

其他回答

在我的示例中,我将以下行添加到~/.zshrc

eval "$(/opt/homebrew/bin/brew shellenv)"

对于此错误,zsh: command not found: brew

确保你已经安装了Brew,用这个(等待它完成安装) (编辑:在结尾添加了结尾引用)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

然后遵循命令行上显示的NEXT STEPS,它应该显示如下所示

==> Next steps:
- Add Homebrew to your PATH in /Users/$USER/.zprofile:
    echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
    eval $(/opt/homebrew/bin/brew shellenv)

在相同的终端窗口上复制并粘贴第一行,然后按enter键

echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile

然后在同一终端窗口复制并粘贴最后一行,然后按enter键

eval $(/opt/homebrew/bin/brew shellenv)

最后,您应该能够使用brew帮助,如果有效,则意味着brew已正确安装并从ZSH运行。

基本上你的自制程序保存在/opt/homebrew/,而不是/usr/local/....路径

打开主目录下的.bash_profile并添加:

export PATH=/opt/homebrew/bin:$PATH

并重新启动终端。你会让它运行起来的。

因为你正在使用zsh,你需要添加路径到你的。zshrc文件:

vim ~ / . zshrc

Add:

export BREW_HOME="/home/linuxbrew/.linuxbrew/bin"
export PATH="$PATH:$BREW_HOME"

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

所以我补充道

导出路径= / opt /组装/ bin:美元的道路

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