根据Homebrew网站,要安装它,我需要输入:
brew install wget
我得到一个错误消息:
-bash: brew: command not found
找到了这个答案。然而,问题是我在/usr/local/bin中没有看到brew。
我在.bashrc文件中添加了下面这行代码
export PATH=/usr/local/bin:$PATH
仍然得到命令未找到错误。
如何在macOS上安装Homebrew ?
根据Homebrew网站,要安装它,我需要输入:
brew install wget
我得到一个错误消息:
-bash: brew: command not found
找到了这个答案。然而,问题是我在/usr/local/bin中没有看到brew。
我在.bashrc文件中添加了下面这行代码
export PATH=/usr/local/bin:$PATH
仍然得到命令未找到错误。
如何在macOS上安装Homebrew ?
当前回答
我在mac BigSur M1处理器上安装Homebrew时遇到了同样的brew命令找不到的问题。
I -安装XCode,如果它还没有安装。
II -选择终端。应用程序在Finder。
III -人民币点击终端,选择“获取信息”
IV -选中“使用Rosetta打开”复选框。
关闭所有打开的终端窗口。
打开一个新的终端窗口,安装Hobebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
测试自制软件的安装。
IIX -取消勾选使用Rosetta打开复选框。
其他回答
在一个开箱即用的MacOS High Sierra 10.13.6
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
给出以下错误:
curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
解决方案:只要在你的卷曲选项中添加一个k
$ ruby -e "$(curl -fsSLk https://raw.githubusercontent.com/Homebrew/install/master/install)"
首先,在MAC终端上粘贴命令来安装自制程序
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后编辑你的.bashrc文件
vi .bashrc
在最后粘贴下面的命令并保存它
export PATH=/opt/homebrew/bin:$PATH
要保存,只需输入:wq并按enter
如果bashrc文件不存在,则只需创建并编辑该文件,以创建类型
touch ~/.bashrc
然后简单地运行命令
source ~/.bashrc
现在尝试使用brew命令,希望它现在可以工作了
更新:如果你使用的是M1 mac,那么在安装homebrew后,只需运行下面提到的命令并重新加载终端
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc
剧本如下:
- usr/bin/ruby -e“curl -fsSL” https://raw.githubusercontent.com/Homebrew/install/master/install)”
如果运行后仍然报错,
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后尝试从https://developer.apple.com/download/more/下载并安装命令行工具,适用于特定的Mac os和Xcode版本。
然后试着跑,
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后
brew install node
对于带有Apple Silicon (M1)的Mac,导出要运行brew命令的shell路径并进入该路径。
export PATH=/opt/homebrew/bin:$PATH
brew