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

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

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

解決方案

Homebrew

Homebrew源代碼倉庫github

  • 替換源地址:
    cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.gitbash

  • 重置爲官方地址:
    cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.giturl

Homebrew Bottles

Homebrew預編譯二進制軟件包code

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

  • 替換源地址:
    • bash:
      echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profilerem

    • zsh:
      echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrcit

Homebrew Core

Homebrew核心軟件倉庫zsh

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

相關文章
相關標籤/搜索