homebrew: 配置国内源(Homebrew 4.0.10-119)
一,查看brew的安装目录:
liuhongdi@liuhongdideMacBook-Pro poem % cd "$(brew --repo)" liuhongdi@liuhongdideMacBook-Pro Homebrew % pwd /usr/local/Homebrew
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/06/05/homebrew-pei-zhi-guo-nei-yuan-homebrew-4-10119/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,查看当前源:
liuhongdi@liuhongdideMacBook-Pro poem % cd "$(brew --repo)" liuhongdi@liuhongdideMacBook-Pro Homebrew % git remote -v origin https://mirrors.ustc.edu.cn/brew.git (fetch) origin https://mirrors.ustc.edu.cn/brew.git (push)
可以看到当前brew的国内源是中科大的镜像
三,设置homebrew的源
以 USTC(中科院)镜像为例:
1,替换 Homebrew 源
$ cd "$(brew --repo)" $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2. 切换 Homebrew Core 源
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3. 切换 Homebrew Cask 源
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
设置源的参考文档:
http://mirrors.ustc.edu.cn/help/brew.git.html
四,查看homebrew的版本:
liuhongdi@liuhongdideMacBook-Pro poem % brew --version Homebrew 4.0.10-119-g931327d Homebrew/homebrew-core (git revision 3d8b912faa5; last commit 2023-04-01) Homebrew/homebrew-cask (git revision 5d24927a9d; last commit 2023-04-01)