之前写了一个Python程序,需要使用telnet
作为客户端,但是在Mac上使用telnet
时,发现 macOS High Sierra 10.13 不再支持telnet
命令。
我尝试使用brew install telnet
,但是:1
MacBook-Air:~ User$ brew install telnet
Updating Homebrew...
然后就没有然后了。
我们可以通过命令
$ cd "$(brew --repo)"
$ git remote -v
origin https://github.com/Homebrew/brew.git (fetch)
origin https://github.com/Homebrew/brew.git (push)
得知官方的 Homebrew 源代码仓库地址是https://github.com/Homebrew/brew.git
,不难看出这是一个GitHub仓库。我们知道,GitHub在国内并不快,这就导致了Update时非常慢。
所以我们可以通过将下载源改为国内镜像解决。
国内的镜像不止一个,比较可靠的有:
清华大学开源软件镜像站 Homebrew 镜像使用帮助链接:
- Homebrew | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source
Mirror - Homebrew Bottles | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
USTC Mirror Help 文档 Homebrew 源使用帮助链接:
- Homebrew 源使用帮助 — USTC Mirror Help 文档
- Homebrew Bottles 源使用帮助 — USTC Mirror Help 文档
- Homebrew Core 源使用帮助 — USTC Mirror Help 文档
- Homebrew Cask 源使用帮助 — USTC Mirror Help 文档
替换 USTC 镜像
因为科大镜像站的 Homebrew 镜像比较多,所以以科大镜像站的 Homebrew 镜像为例。
- 替换 Homebrew 源代码仓库的USTC镜像:
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
这样使用命令brew update
更新时会快很多。
2. 替换 Homebrew 核心软件仓库 USTC 镜像:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
这样,执行命令brew install FORMULA...
& brew upgrade [FORMULA...]
时安装会快很多。
3. 重置为官方地址:
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core
- 以
$
开头的行表示输入的命令。 ↩