根据Homebrew网站,要安装它,我需要输入:

brew install wget

我得到一个错误消息:

-bash: brew: command not found

找到了这个答案。然而,问题是我在/usr/local/bin中没有看到brew。

我在.bashrc文件中添加了下面这行代码

export PATH=/usr/local/bin:$PATH

仍然得到命令未找到错误。

如何在macOS上安装Homebrew ?


当前回答

如何设置你的Mac为家酿

步骤1

检查你已经安装了Xcode。在终端上运行下面的命令

/usr/bin/xcodebuild -version

它将打印以下示例输出:

Xcode 12.3 Build version 12C33

步骤2

现在打开Xcode:

选择偏好 选择位置选项卡 现在在命令行工具中从下拉菜单中选择你的Xcode版本

步骤3

在终端运行以下命令:

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

注意:如果你有M1芯片Mac运行下面的命令,关闭终端,再打开终端

echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc

其他回答

我可能迟到了,但是有一个很酷的网站,你可以在那里搜索软件包,它会列出安装这些东西的必要命令。 BrewInstall是网站。

但是你可以用下面的命令安装wget:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget

希望这对你有所帮助。

在macOS上安装自制程序

要安装自制程序,你可以简单地在终端上运行这个命令…

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

如果你需要帮助安装任何包从自制这个页面应该有帮助

我在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打开复选框。

就在家酿网站主页的顶部。

终端提示符:

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

命令brew install wget演示了如何在已经安装brew之后使用Homebrew安装另一个应用程序(在本例中是wget)。


历史……

在大约2020年之前,Homebrew页面上给出的命令是:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

在一个开箱即用的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)"