返回

Homebrew:别再忍受缓慢的源下载!改善设置即可加速镜像下载

开发工具

Homebrew 镜像的优势

Homebrew 镜像提供以下优势:

  • 更快的下载速度: Homebrew 镜像通常位于离您更近的位置,因此可以提供更快的下载速度。
  • 更可靠的服务: Homebrew 镜像由社区维护,这意味着它们通常比官方 Homebrew 镜像更可靠。
  • 更广泛的软件包选择: Homebrew 镜像通常提供比官方 Homebrew 镜像更广泛的软件包选择。

如何设置 Homebrew 镜像

要设置 Homebrew 镜像,请按照以下步骤操作:

  1. 打开终端。
  2. 运行以下命令:
brew config
  1. 找到以下行:
HOMEBREW_BOTTLE_DOMAIN="https://mirrors.brew.sh/bottles"
  1. https://mirrors.brew.sh/bottles 替换为您的首选镜像。例如,如果您想使用阿里云镜像,则可以将其替换为 https://mirrors.aliyun.com/homebrew/brew/
  2. 运行以下命令保存更改:
brew config set HOMEBREW_BOTTLE_DOMAIN https://mirrors.aliyun.com/homebrew/brew/
  1. 重新加载 Homebrew:
brew update-reset

测试 Homebrew 镜像

要测试 Homebrew 镜像是否已正确设置,请运行以下命令:

brew doctor

如果一切正常,您应该会看到以下输出:

Your system is ready to brew.

Homebrew 镜像列表

以下是一些可用的 Homebrew 镜像:

  • 阿里云镜像:https://mirrors.aliyun.com/homebrew/brew/
  • 清华大学镜像:https://mirrors.tuna.tsinghua.edu.cn/homebrew/brew/
  • 中科大镜像:https://mirrors.ustc.edu.cn/homebrew/brew/
  • 上海交通大学镜像:https://mirrors.sjtug.sjtu.edu.cn/homebrew/brew/
  • 华东师范大学镜像:https://mirrors.ecnu.edu.cn/homebrew/brew/
  • 中南大学镜像:https://mirrors.csu.edu.cn/homebrew/brew/
  • 哈尔滨工业大学镜像:https://mirrors.hit.edu.cn/homebrew/brew/
  • 西安交通大学镜像:https://mirrors.xjtu.edu.cn/homebrew/brew/
  • 中山大学镜像:https://mirrors.sysu.edu.cn/homebrew/brew/
  • 华南理工大学镜像:https://mirrors.scut.edu.cn/homebrew/brew/

您可以根据您的需要选择一个合适的镜像。

结语

Homebrew 镜像是一种简单而有效的方法来加速 Homebrew 的下载速度。通过使用 Homebrew 镜像,您可以显著地改善 Homebrew 的下载速度,特别是对于下载大型软件包时。如果您遇到 Homebrew 下载缓慢的问题,不妨试试使用 Homebrew 镜像来解决问题。