zoukankan      html  css  js  c++  java
  • brew之加速

      有没有出现这种场景:使用brew install 安装程序,一直卡在brew updating,这可能是使用着默认的github镜像源导致,那么我们就需要将其切换到国内

    1.镜像切换(推荐中科大)

    1)替换brew.git
    cd "$(brew --repo)"
    
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git //清华
    或
    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 //中科大
    或
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/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

    4)替换homebrew-bottles: 
    echo
    'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

    echo
    'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile

    5)应用生效 brew update -v (查看过程)

    2.镜像复原

    # 重置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

    3. 问题修复

    # 诊断Homebrew的问题:
    $ brew doctor
    
    # 重置brew.git设置:
    $ cd "$(brew --repo)"
    $ git fetch
    $ git reset --hard origin/master
    
    # homebrew-core.git同理:
    $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    $ git fetch
    $ git reset --hard origin/master
    
    # 应用生效:
    $ brew update  
  • 相关阅读:
    hdu 1704 Rank(floyd传递闭包)
    codeforces 85D. Sum of Medians(线段树or分块)
    hdu 1706 The diameter of graph(folyd计数)
    hdu 4705 Y(树形DP)
    hdu 4123 Bob’s Race(树形DP+rmq)
    hdu 2196 Computer(树形DP)
    hdu 3534 Tree(树形DP)
    hdu 6017 Girls Love 233(dp)
    [HDU5903]Square Distance(DP)
    HDU5878~HDU5891 2016网络赛青岛
  • 原文地址:https://www.cnblogs.com/xingxia/p/Mac_brew_faster.html
Copyright © 2011-2022 走看看