Mac下Homebrew替换镜像

…衆ロ難τιáo~ 提交于 2020-01-07 20:03:59

替换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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!