常用的 Homebrew 国内镜像源

在国内使用 Homebrew 时,常常会遇到下载缓慢、超时的问题。目前许多国内大厂和高校都提供了镜像源,帮助开发者更高效地安装和管理软件包。

🧪

1. 清华大学 TUNA 镜像

Git 仓库镜像:

brew.git: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
homebrew-core.git: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
homebrew-cask.git: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

预编译 bottles 镜像:

HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

📍特点:官方镜像站维护较好,适合大部分用户使用。

配置命令:

# 替换 brew 源 git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换 core git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换 cask git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 设置 bottles(临时) export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# 设置 bottles(永久,添加到 ~/.zshrc) echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
🐼

2. 中国科学技术大学 USTC 镜像

Git 仓库镜像:

brew.git: https://mirrors.ustc.edu.cn/brew.git
homebrew-core.git: https://mirrors.ustc.edu.cn/homebrew-core.git
homebrew-cask.git: https://mirrors.ustc.edu.cn/homebrew-cask.git

bottles 镜像:

HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles

📍特点:国内访问速度也很快,适合替代官方源。

配置命令:

# 替换 brew 源 git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 替换 core git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 替换 cask git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# 设置 bottles(临时) export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
# 设置 bottles(永久,添加到 ~/.zshrc) echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
☁️

3. 阿里云镜像

Git 仓库镜像:

brew.git: https://mirrors.aliyun.com/homebrew/brew.git
homebrew-core.git: https://mirrors.aliyun.com/homebrew/homebrew-core.git

预编译 bottles 镜像:

HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew-bottles

📍特点:阿里云镜像站也提供 Homebrew 镜像,可用来替换官方源提高速度。

配置命令:

# 替换 brew 源 git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换 core git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 设置 bottles(临时) export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew-bottles
# 设置 bottles(永久,添加到 ~/.zshrc) echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew-bottles' >> ~/.zshrc
📌

镜像覆盖内容

这些国内源一般会提供:

brew 本身的源码镜像
homebrew-core 核心配方仓库镜像
homebrew-cask(部分镜像站)应用程序安装包仓库镜像
bottles(预编译二进制包)镜像 👆

💡换了这些以后 brew updatebrew install 都能明显快很多。

💡

使用场景

需求推荐镜像
安装 Homebrew(全套)清华 / USTC / 阿里
更新 Formula 索引清华 / USTC / 阿里
下载预编译 bottles 包清华 / USTC / 阿里
🛠

快速切换示例(以清华为例)

以下是一套完整的切换命令,按顺序执行即可将 Homebrew 切换到清华大学镜像源:

# 替换 brew 源 git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换 core git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换 cask git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 设置 bottles echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
# 使环境变量生效 source ~/.zshrc
# 更新 Homebrew brew update

💡提示:如果使用 bash,请将 ~/.zshrc 替换为 ~/.bash_profile~/.bashrc

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

oldzhang的头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

免费获取在线技术支持请 提交工单,官方QQ群:13763429 。
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动