Homebrew 镜像源配置

前言

当我们使用默认官方源时,经常会遇到以下问题

查看镜像配置

复制代码
  1. brew config
切换国内源

复制代码
  1. /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
4.0 镜像配置

温馨提示:不要使用阿里云的 Homebrew 源,好久没更新了,而且还不支持 Homebrew 4.0 的镜像源

清华大学镜像站
复制代码
  1. # homebrew 4.x 清华大学镜像 最新的 JSON API 安装方式
  2. export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
  3. export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
  4. export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
中国科学技术大学镜像源
复制代码
  1. # homebrew 4.x 中科大镜像 最新的 JSON API 安装方式
  2. export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
  3. export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
  4. export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"

如果 shell 为 zsh,也就是添加 ~/.zshrc 文件中,然后执行以下命令或重新打开窗口

复制代码
  1. source ~/.zshrc
4.x 以前镜像配置

Zsh 终端配置 (阿里云镜像源)

复制代码
  1. # 替换brew.git:
  2. cd "$(brew --repo)"
  3. git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
  4. # 替换homebrew-core.git:
  5. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  6. git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
  7. # 应用生效
  8. brew update
  9. # 替换homebrew-bottles:
  10. echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
  11. source ~/.zshrc

恢复 Homebrew 默认配置

复制代码
  1. # 替换 brew.git
  2. cd "$(brew --repo)"
  3. git remote set-url origin https://github.com/Homebrew/brew.git
  4. # 替换 homebrew-core.git
  5. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  6. git remote set-url origin https://github.com/Homebrew/homebrew-core.git
  7. # 应用生效
  8. brew update
  9. # 删除 homebrew-bottles:
  10. # 注释掉 .zshrc 中的 HOMEBREW_BOTTLE_DOMAIN
  11. source ~/.zshrc
相关推荐
若兰幽竹4 小时前
【从零开始编写数据库:基于Python语言实现数据库ToyDB的ACID特性】
数据库·python
宇钶宇夕4 小时前
S7-200 SMART CPU 密码清除全指南:从已知密码到忘记密码的解决方法
运维·服务器·数据库·程序人生·自动化
周杰伦的稻香4 小时前
MySQL密码管理器“mysql_config_editor“
数据库·mysql
risc1234564 小时前
【Elasticsearch】function_score与rescore
elasticsearch
云朵大王4 小时前
SQL 视图与事务知识点详解及练习题
java·大数据·数据库
czhc11400756635 小时前
LINUX712 MYSQL;磁盘分区;NFS
数据库·mysql·adb
不太可爱的大白5 小时前
Mysql:分库分表
数据库·mysql
十五年专注C++开发6 小时前
hiredis: 一个轻量级、高性能的 C 语言 Redis 客户端库
开发语言·数据库·c++·redis·缓存
萤火虫儿飞飞6 小时前
从基础加热到智能生态跨越:艾芬达用创新重构行业价值边界!
大数据·人工智能·重构
seanmeng20226 小时前
Apache Iceberg on AWS - 通过Firehose流式导入数据到Iceberg表
大数据