Homebrew官方的源一般下载包之类的会很慢,所以通常我们都是用国内的镜像源来代替,这样会提高我们的效率。Homebrew主要有四个部分组成: brew、homebrew-core 、homebre
Homebrew官方的源一般下载包之类的会很慢,所以通常我们都是用国内的镜像源来代替,这样会提高我们的效率。Homebrew主要有四个部分组成: brew、homebrew-core 、homebrew-bottles、homebrew-cask。
名称 说明
brew Homebrew 源代码仓库
homebrew-core Homebrew 核心软件仓库
homebrew-bottles Homebrew 预编译二进制软件包
homebrew-cask MacOS 客户端应用
Homebrew国内镜像源目前主要有中科大镜像、阿里镜像、清华镜像。
在命令行输入以下命令可以查询:
查看 brew.git 当前源
cd "$(brew --repo)" && git remote -v
查看 homebrew-core.git 当前源
cd "$(brew --repo homebrew/core)" && git remote -v
如果输出是下面这些,就代表不是本地镜像源,可以换成本地镜像源,这样下载会更快点。
查看 brew.git 当前源输出
originhttps://GitHub.com/Homebrew/brew.git (fetch)originHttps://github.com/Homebrew/brew.git (push)
查看 homebrew-core.git 当前源输出
originhttps://github.com/Homebrew/homebrew-core.git (fetch)originhttps://github.com/Homebrew/homebrew-core.git (push)
替换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
替换homebrew-cask.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
zsh 替换homebrew-bottles镜像,Mac OS在10.15系统开始,默认的shell都换成了zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
修改使其立即生效
source ~/.zshrc
bash 替换homebrew-bottles镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
修改使其立即生效
source ~/.bash_profile
刷新源
brew update
替换brew.git:
cd "$(brew --repo)" && git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
zsh 替换homebrew-bottles镜像,Mac OS在10.15系统开始,默认的shell都换成了zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
修改使其立即生效
source ~/.zshrc
bash 替换homebrew-bottles镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
修改使其立即生效
source ~/.bash_profile
刷新源
brew update
替换brew.git:
cd "$(brew --repo)" && git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
替换homebrew-core.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
替换homebrew-cask.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
zsh 替换homebrew-bottles镜像,Mac OS在10.15系统开始,默认的shell都换成了zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
修改使其立即生效
source ~/.zshrc
bash 替换homebrew-bottles镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
修改使其立即生效
source ~/.bash_profile
刷新源
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
重置 homebrew-cask.git 为官方源:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://github.com/Homebrew/homebrew-cask
zsh 注释掉 HOMEBREW_BOTTLE_DOMaiN 配置,前面加#符号就行
vi ~/.zshrC# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
修改使其立即生效
source ~/.zshrc
bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置,前面加#就行
vi ~/.bash_profile# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
修改使其立即生效
source ~/.bash_profile
刷新源
brew update
————————————————
版权声明:本文为CSDN博主「TyrantBoy」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/H_WeiC/article/details/107857302
来源地址:https://blog.csdn.net/weixin_44609676/article/details/130193548
--结束END--
本文标题: macos homebrew 源更改
本文链接: https://lsjlt.com/news/395945.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0