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

当前回答

确保先安装brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

其他回答

你的电脑上已经安装了自制软件。你需要像这样修改你的PATH:

export PATH=/usr/local/bin:$PATH

或者从起始点执行brew:

/usr/local/bin/brew install maven

确保先安装brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

我在Ubuntu和Arch Linux上也遇到了同样的问题。我通过在.zshrc文件中添加brew的bin文件夹路径来解决这个问题。

brew安装bin目录的路径是/home/linuxbrew/.linuxbrew/bin

将下面的行添加到~/。zshrc中 导出路径= / home / linuxbrew / .linuxbrew / bin:美元的道路

在此之后,打开一个新终端,brew命令将可用。

在您的.zshrc文件中,将路径添加到您的homebrew/bin,无论它可能在哪里。在我的例子中,homebrew安装在我的主目录中。 添加:

export PATH="/<path-to-homebrew-directory>/bin:$PATH"

重新启动终端,让它接收到.zshrc的更改

它帮助我。只需运行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)"