Mac下Homebrew替換鏡像


替換git和homebrew鏡像源

一、git加速

  1. 查找域名對應的地址
    nslookup github.com
    nslookup github.global.ssl.fastly.Net

  2. 修改hosts文件

    sudo vim /etc/hosts
    # add two lines at the end.
    31.13.66.1 github.global.ssl.fastly.net 
    13.229.188.59 github.com
    
  3. 刷新DNS緩存(根據你的操作系統選擇)

    # Mac
    sudo killall -HUP mDNSResponder
    # linux
    sudo /etc/init.d/networking restart
    

二、homebrew替換為清華鏡像源

清華鏡像站:清華鏡像站

homebrew替換指南:幫助文檔

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update


免責聲明!

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



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