美文网首页
Homebrew 安装时禁用 update

Homebrew 安装时禁用 update

作者: BenjaminU | 来源:发表于2020-03-02 17:30 被阅读0次

    一、直接关闭brew执行命令时的自动更新

    # 1. 编辑配置文件
    vim ~/.bash_profile
    
    # 2. 文件内新增一行
    export HOMEBREW_NO_AUTO_UPDATE=true
    
    # 3. 重新加载配置文件
    source ~/.bash_profile
    

    二、替换brew源方法一

    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
    brew update
    
    # 备用地址-1
    cd "$(brew --repo)"
    git remote set-url origin https://git.coding.net/homebrew/homebrew.git
    brew update
    
    # 备用地址-2
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/brew.git
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew-core.git
    brew update
    

    PS:官方默认信息

    # 1. 重置brew.git
    cd "$(brew --repo)"
    git remote set-url origin https://github.com/Homebrew/brew.git
    
    # 2. 重置homebrew-core.git
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://github.com/Homebrew/homebrew-core.git
    

    from: [https://www.jianshu.com/p/77c60428569d]

    二、替换brew源方法二

    bash用户:
    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
    source ~/.bash_profile
    
    zsh用户:
    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
    source ~/.zshrc
    

    相关文章

      网友评论

          本文标题:Homebrew 安装时禁用 update

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