替换 Git 和 homebrew 镜像源
一, Git 加速
查找域名对应的地址
- nslookup GitHub.com
- nslookup GitHub.global.ssl.fastly.NET
修改 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
刷新 DNS 缓存 (根据你的操作系统选择)
- # Mac
- sudo killall -HUP mDNSResponder
- # Linux
- sudo /etc/init.d/networking restart
二, homebrew 替换为清华镜像源
清华镜像站: 清华镜像站 https://mirrors.tuna.tsinghua.edu.cn/
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
来源: http://www.bubuko.com/infodetail-3365014.html