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

brew install wget

我得到一个错误消息:

-bash: brew: command not found

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

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

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

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

如何在macOS上安装Homebrew ?


当前回答

不知道为什么没有人提到这一点:当你从官方网站运行安装命令时,在最后几行你会看到如下内容,你需要遵循==>下一步:

==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Add Homebrew to your PATH in /Users/{YOUR USER NAME}/.bash_profile:
    echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/{YOUR USER NAME}/.bash_profile
    eval $(/opt/homebrew/bin/brew shellenv)

这是bash shell的。对于每个不同的shell,您将看到不同的步骤,但是这些步骤的源是相同的。

其他回答

打开终端,输入下面的命令。 安装:

/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/uninstall)"

一旦安装完成后,输入brew命令:

brew install wget
brew install node
brew install watchman
...
...

如果您在代理下,以下命令将不起作用。

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

相反,用户关注

ruby -e "$(curl -x http://DOMAIN%5cUSER_NAME:PASSWORD@PROXY:PORT -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

请注意,我们必须使用%5c而不是“\”同样,如果您的密码有任何特殊字符,请将其替换为unicode,例如@使用%40 参考本unicode

用你自己的参数替换上面的命令

域名-你的域名

USER_NAME—您的用户名

PASSWORD -密码

Proxy - 10.10.10.10

端口- 8080

在终端中添加以下内容,单击“enter”,然后按照终端中的说明操作。/usr/bin/ruby -e "$(curl - ssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

检查是否安装了Xcode:

$ gcc --version

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

$ brew doctor

$ brew update

http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html“点击这里获取准确的指令更新”

剧本如下:

- usr/bin/ruby -e“curl -fsSL” https://raw.githubusercontent.com/Homebrew/install/master/install)”