美文网首页
homebrew切换下载源

homebrew切换下载源

作者: 薛延祥 | 来源:发表于2020-04-30 16:30 被阅读0次

默认的官方源地址是境外的,必须翻墙,比较慢,可以切换为国内的数据源,速度比较快

Homebrew安装主要靠git仓库,切换源实际上就是切换相关git repo的remote url.

具体做法:

找到brew.git和homebrew-core.git的本地repo

切换两个repo的remote url

1、切换USTC源:https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git

(1)# 更换brew.git的源

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

(2)# 更换homebrew-core.git的源

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

(3)brew update

注意,此时可能会报各种域名地址找不到,在/etc/hosts的文件中添加对应的IP即可

192.30.255.113  github.com

 1113.250.94.254  api.github.com

 12202.38.95.110  mirrors.ustc.edu.cn

(4)另外,还需要更换Homebrew Bottle源,这个只要在shell配置文件里加上(或更改)一个变量即可。

如zsh就是编辑~/.zshrc文件, bash就是~/.bash_profile文件:

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

再 source ~/.bash_profile和 source ~/.zshrc 即可。

2、切换清华源: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

3、重置官方源

# 重置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 下载源

    设置阿里下载源 恢复下载源 需要把 ~/.zshrc 中的 HOMEBREW_BOTTLE_DOMAIN 环境变...

  • homebrew切换下载源

    默认的官方源地址是境外的,必须翻墙,比较慢,可以切换为国内的数据源,速度比较快 Homebrew安装主要靠git仓...

  • Mac安装svn(subversion)教程

    1.Homebrew(brew)安装脚本,请按提示选择下载源(如果遇到失败,请按提示切换下载源 自测成功选择的是“...

  • homebrew切换下载源命令汇总

    注意:非必要情况下,不要切换homebrew下载源,因为大量的公司配置和操作都是基于git的,切换数据源可能导致各...

  • Mac brew 包管理工具安装与常用包

    安装homebrew(自动切换了国内镜像) 安装最新的ruby 更改ruby的源 安装下载工具 wget 安装py...

  • 替换及重置homebrew默认源

    中科大源 替换官方源: 切换回官方源: 清华源 替换官方源: 切换回官方源:注:该镜像是 Homebrew 的 f...

  • 安装HomeBrew

    一、安装HomeBrew 1.1 官网安装方法 1.2 更改下载源解决上述安装问题 1.3 Homebrew换源 ...

  • 解决macos 安装homebrew速度慢

    问题描述 安装的homebrew的时候下载速度超级慢,解决办法是更换homebrew的下载源 操作步骤 打开终端,...

  • Mac Homebrew 更换中国源

    Homebrew安装主要靠git仓库,切换源实际上就是切换相关git repo的remote url. 具体做法:...

  • 切换npm下载源

网友评论

      本文标题:homebrew切换下载源

      本文链接:https://www.haomeiwen.com/subject/fyqtghtx.html