美文网首页
brew更新源方法

brew更新源方法

作者: 我是一个人在战斗 | 来源:发表于2019-04-17 09:03 被阅读0次

     MacOS 系统使用源生 brew 更新会非常慢。

    通过收集与整理有二个办法还是比较有一些更新速度提升的。

    方法1:通过修改 host 方法。

    (我是通过 swtichHosts.app)进行修改,增加如下配置

    # brew 安装 git 报错问题
    192.30.253.113 github.com

    上述方面可以在部分网络情况下,提高原生 brew 安装与升级的速度。

    文法2:修改原生 brew 更新源地址。

    参考: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

    brew update

    使用homebrew-science或者homebrew-python

    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


    复原方法

    cd "$(brew --repo)"

    git remote set-url origin https://github.com/Homebrew/brew.git

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

    git remote set-url origin https://github.com/Homebrew/homebrew-core

    brew update

    总结

    上述两种方法都测试过。都存在一定的不稳定情况。可以视环境而定。

    相关文章

      网友评论

          本文标题:brew更新源方法

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