➜ ~ /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)"
其他回答
对于此错误,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运行。
在您的.zshrc文件中,将路径添加到您的homebrew/bin,无论它可能在哪里。在我的例子中,homebrew安装在我的主目录中。 添加:
export PATH="/<path-to-homebrew-directory>/bin:$PATH"
重新启动终端,让它接收到.zshrc的更改
我尝试了上面的方法 导出路径= / opt /组装/ bin:美元的道路 但是没有用。
所以我做了我的研究,并意识到上述代码适用于苹果芯片Mac,而不是英特尔芯片Mac。
所以我对代码进行了编辑,因为我的Mac是基于英特尔的,我这样做了,工作完美:
在查找器中,打开/编辑.zshrc文件,如果找不到,则创建一个。 粘贴以下代码:
导出路径= / usr /地方/组装/ bin:美元的道路
会有用的!!
您应该同时将/opt/homebrew/bin和/opt/homebrew/sbin添加到$PATH env中。
导出路径= / opt /组装/ bin: / opt /组装/ sbin: $路径
快捷方式:运行command
echo export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/sbin >> ~/.zshrc . sh
然后运行酿酒医生检查
在我的MacBook (macOS Big Sur V 11.0.1)安装Homebrew后,我也遇到了同样的问题。
安装完成后,在控制台中会显示应该做什么:
==>下一步: -将Homebrew添加到/Users/USER/.zprofile中的PATH: echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/USER/.zprofile . sh Eval $(/opt/homebrew/bin/brew shellenv) -运行“brew help”开始
按顺序执行这两个命令,会将brew命令添加到PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/USER/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
推荐文章
- 如何从终端机发送电子邮件?
- 在Mac OS X上哪里安装Android SDK ?
- Mac/OS X上的/var/lib/docker在哪里
- Xcode构建失败“架构x86_64未定义的符号”
- 在OSX 10.11中安装Scrapy时,“OSError: [Errno 1]操作不允许”(El Capitan)(系统完整性保护)
- 如何在Mac OS X 10.6中使硬件发出哔哔声
- 从Cocoa应用程序执行一个终端命令
- Android Studio无法找到有效的Jvm(与MAC OS相关)
- NSRange从Swift Range?
- 如何在交互式Python中查看整个命令历史?
- 在OSX中永久设置PATH环境变量
- 如何停止mysqld
- Git显示“警告:永久添加到已知主机列表”
- 如何从远程SSH会话发送数据到本地剪贴板
- Docker- compose无法连接到Docker Daemon