Mac上使用brew update會卡住的問題


Mac上使用brew update會卡住的問題

brew默認的源是Github,會非常慢,建議換為國內的源。推薦中科大的鏡像源,比較全面.

解決方案

Homebrew

Homebrew源代碼倉庫

  • 替換源地址:

    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
    
  • 重置為官方地址:

    cd "$(brew --repo)"
    git remote set-url origin https://github.com/Homebrew/brew.git
    

Homebrew Bottles

Homebrew預編譯二進制軟件包

在運行brew, 前設置環境變量HOMEBREW_BOTTLE_DOMAIN,值為https://mirrors.ustc.edu.cn/homebrew-bottles

  • 替換源地址:
    • 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 Core

Homebrew核心軟件倉庫

  • 替換源地址:

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    
  • 重置為官方地址:

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

Homebrew Cask

Homebrew cask軟件倉庫,提供macOS應用和大型二進制文件

  • 替換源地址:

    cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
    git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
    
  • 重置為官方地址:

    cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
    git remote set-url origin https://github.com/Homebrew/homebrew-cask
    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM