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

当前回答

我将演示来自@Spindizzy的答案:

cd ~ | ls -a
touch .zshrc // if file .zshrc doesn't exists we create it
vim .zshrc

将PATH=/opt/homebrew/bin:$PATH粘贴到那里,保存文件并重启终端。

Vim助手:

1. press "i" to interactive mode in vim, paste:
export PATH=/opt/homebrew/bin:$PATH
2. press "esc" type ":wq" and hit enter

其他回答

基本上你的自制程序保存在/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"

可能会迟到,但肯定会有帮助。你必须首先安装brew。只要运行下面的命令就可以了:

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

也许不是很明显,但是除了上面的步骤之外,检查您的.zshprofile是否被任何多余的引号损坏。您还应该关闭所有终端实例。

下面是我做的步骤。

1.安装自酿酒

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

2.运行brew help,看看它是否工作…如果显示错误“zsh: command not found: brew”,请继续执行。

修改路径为:

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

记得把“用户名”改成你的, 然后输入:

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

成功运行这些命令后,键入“brew help”查看是否一切正常。