如何判断我是否正确安装了 Homebrew?

How can I tell whether I installed Homebrew correctly?

不久前,我在我的 Mac 上安装了 Homebrew,我担心我安装不当导致 Brew 无法正常工作。我可以从终端 运行 使用某种命令来检查是否一切正常吗?

我担心设置不正确的原因有两个:

  1. 我正在观看 this tutorial,其中他 运行 发出了命令 brew search,它为他提供了一个他可以安装的软件包列表。但是当我 运行 命令时,我收到错误消息 This command requires at least 1 text or regex argument. 这正常吗?
  2. 当我 运行 brew 命令时,它比我从终端 运行 其他命令花费的时间长得多(可能 3 秒)。这正常吗?

brew --version 将是检查软件是否安装成功的基本且最简单的方法。

$ brew --version
Homebrew 3.2.17-108-ge518ea4
Homebrew/homebrew-core (git revision 4eaec4244d4; last commit 2021-10-21)
Homebrew/homebrew-cask (git revision 4d10ee7007; last commit 2021-10-22)

对于 brew 命令,您可以 运行 帮助了解您可以尝试的更多选项,例如

$ brew search --help
Usage: brew search, -S [options] text|/regex/ [...]

Perform a substring search of cask tokens and formula names for text. If
text is flanked by slashes, it is interpreted as a regular expression. The
search for text is extended online to homebrew/core and homebrew/cask.

      --formula, --formulae        Search online and locally for formulae.
      --cask, --casks              Search online and locally for casks.
      --desc                       Search for formulae with a description
                                   matching text and casks with a name
                                   matching text.
      --pull-request               Search for GitHub pull requests containing
                                   text.
      --open                       Search for only open GitHub pull requests.
      --closed                     Search for only closed GitHub pull
                                   requests.
      --repology                   Search for text in the given database.
      --macports                   Search for text in the given database.
      --fink                       Search for text in the given database.
      --opensuse                   Search for text in the given database.
      --fedora                     Search for text in the given database.
      --archlinux                  Search for text in the given database.
      --debian                     Search for text in the given database.
      --ubuntu                     Search for text in the given database.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.

例如,如果我想安装go,我可以做brew search go:

$ brew search node
==> Formulae
heroku/brew/heroku-node ✔            node ✔                               node@10                              node_exporter                        nodenv
libbitcoin-node                      node-build                           node@12                              nodebrew                             ode
llnode                               node-sass                            node@14                              nodeenv
==> Casks
font-ubuntu-mono-derivative-powerline                         nodebox                                                       nodeclipse
nodebox                                                       nodeclipse

If you meant "node" specifically:
It was migrated from homebrew/cask to homebrew/core.