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

当前回答

编辑.zshrc文件:

nano .zshrc

并在文件的开头添加以下内容:

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

保存并运行:

source ~/.zshrc 

其他回答

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

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

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

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

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

vim ~ / . zshrc

Add:

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

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

运行以下设置,然后就可以使用brew了

执行unintsall脚本:-

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

设置Git Compression:- Git config——global core.compression 0

设置Git缓冲区大小:- Git config——global http。postBuffer 1048576000

运行安装脚本:— /bin/bash -c $(curl - ssl https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

在安装时,brew有这个-NEXT STEPS控制台日志,需要包含它到bash的路径。

执行如下步骤:

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

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