➜  ~ /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。只要运行下面的命令就可以了:

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

其他回答

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

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

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

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

16.11.2022 -更新 在brew安装期间,我得到了多行通知我将在哪里安装brew。终端对我说:

This script will install:
...
/usr/local/Homebrew

我需要的路径是最后一个。解决问题的步骤:

编辑.zshrc文件。类型: 纳米~ / . zshrc 在编辑器中添加一行: 导出路径= / usr /地方/组装/ bin:美元的道路 点击Control+X退出编辑器,Y接受更改,返回接受文件将保存的位置。

毕竟,您需要刷新您使用的终端。您可以关闭它的进程并打开或键入:

来源 ~/.zshrc

就是这样!希望有帮助。

Ubuntu 20.04的解决方案

安装brew后: /bin/bash -c $(curl - ssl https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 然后运行它所说的(这对我来说什么都没有,只是每次我运行它时都向.zprofile添加行): 回显“eval”$(/home/linuxbrew/。linuxbrew / bin /酿造shellenv)' >> /home/blcuser/.zprofile . ' eval”(/ home / linuxbrew /美元。linuxbrew / bin /酿造shellenv)” 在关闭终端之前,复制输出: 回声路径美元 应该类似于这个:

/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

我们需要的是酿造路径也就是预览路径的这一部分(对你来说可能是另一条路径)

/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin

打开NEW终端,尝试使用以下命令构建整个第一条路径:

应该像这样:<brew_path>:$PATH

对我来说是:echo /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH

应该输出我们在4上输出的第一个完整路径。

打开.zshrc文件(我的是在home隐藏文件) 在.zshrc文件的开头,添加我们在5.上构建的内容: 导出路径= / home / linuxbrew / .linuxbrew / bin: / home / linuxbrew / .linuxbrew / sbin:美元的道路 保存并重新启动终端 检查正在工作的: 酿造的医生

默认情况下,您应该总是以新终端启动设置和酿造。

运行以下设置,然后就可以使用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)"

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