Mac Homebrew 更换中国源
Homebrew安装主要靠git仓库,切换源实际上就是切换相关git repo的remote url.
具体做法:
- 找到
brew.git
和homebrew-core.git
的本地repo - 切换两个repo的remote url
切换USTC源:https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git
# 更换brew.git的源 cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 更换homebrew-core.git的源 cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git brew update
另外,还需要更换Homebrew Bottle
源,这个只要在shell配置文件里加上(或更改)一个变量即可。
如zsh就是编辑~/.zshrc
文件, bash就是~/.bash_profile
文件:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
切换清华源:https://mirror.tuna.tsinghua.edu.cn/help/homebrew/
cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-science" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-science.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-python" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-python.git brew update
重置官方源:
# 重置brew.git: cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git # 重置homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git
原文地址:https://www.jianshu.com/p/63bd1c567362
相关推荐
-
linux安装subversion 服务器
2019-3-6
-
通过玩命令行游戏来测试你的 BASH 技能 服务器
2019-2-24
-
如何在 Ubuntu 14.10 上安装 KDE Plasma 5.2 服务器
2019-3-13
-
开源数据集成工具DataX Web 2.1.1发布 服务器
2020-6-27
-
数据库之MySQL与Python交互 服务器
2019-9-11
-
微服务治理实践:如何对单点异常进行自动摘除 服务器
2020-7-16
-
解决”并发下查询并更新带来的问题” 服务器
2019-6-22
-
Binary Bomb: 二进制炸弹 服务器
2019-3-15
-
核心数据类型 服务器
2019-11-2
-
Knative 基本功能深入剖析:Knative Serving 之服务路由管理 服务器
2019-9-16