在 macOS Catalina 上安装 CommandLineTools 时 Homebrew 安装程序挂起

Homebrew installer hangs while installing CommandLineTools on macOS Catalina

我正在尝试将 Homebrew 安装到 Intel MacBookPro (macOS Catalina) 上,但是 运行正在 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 在终端中,它似乎在安装 CommandLineTools 时挂起(挂起的特定行是 ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress)。

我已经在这台机器上完整安装了 Xcode 11(据我所知安装了 Xcode CommandLineTools)。

导航到 /tmp 后,我发现它成功 运行 touch 并创建了命令中描述的文件 运行,但从未向其中写入任何内容。

我等了大概一个小时没有结果。这是日志:

==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their owner set to (redacted for privacy):
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their group set to admin:
/usr/local/bin
/usr/local/lib
==> The following new directories will be created:
/usr/local/etc
/usr/local/include
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.

Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/mkdir -p /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy):admin /usr/local/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy) /Users/(redacted for privacy)/Library/Caches/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress

我会重新安装 Xcode 命令行工具:

  1. sudo rm -rf /Library/Developer/CommandLineTools
  2. xcode-select --install

我也遇到过同样的情况。我不得不升级到 macOS Monterey(我还在大苏尔)。

我遇到了同样的问题。我尝试安装 Command Line Tools(CLT),但我得到了相同的发现软件对话框,但一分钟后就没有进展了。

对我来说,事实证明我根本没有 Xcode,CLT 似乎依赖于 Xcode。我也没有 Library/developer 目录。

我下载并安装了 Xcode,但我仍然无法使用命令行安装 CLT,我不得不下载并手动安装。

获得所有设置自制程序后,不再尝试安装 CLT 并且能够成功完成其安装。

我是 Mac 的新手,之前从未使用过。我开始在一家新公司工作,他们提供了它,但我不确定它是否是 pre-used,因为它已经安装了一些应用程序。也许 Xcode 已被删除或对我来说从未存在过。 此页面详细解释了 Xcode 和 CLT 的整个过程 https://www.freecodecamp.org/news/how-to-download-and-install-xcode/