Mac配置
mac的brew配置以及终端代理
替换Homebrew镜像源
- bash终端配置
- 替换brew.git:
cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
- 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
- 应用生效
brew update
- 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
Zsh 终端配置
# 替换brew.git: cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # 替换homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # 应用生效 brew update # 替换homebrew-bottles: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
恢复默认配置
- 首先执行下述命令:
# 重置brew.git: cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git # 重置homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git
- 然后删掉 HOMEBREW_BOTTLE_DOMAIN 环境变量,将你终端文件
或者~/.bash_profile
中~/.zshrc
行删掉, 并执行HOMEBREW_BOTTLE_DOMAIN
或者source ~/.bash_profile
source ~/.zshrc
终端走代理
- 临时的方式,影响最小
e.g.export http_proxy=http://proxyAddress:port
export http_proxy="http://127.0.0.1:1087" export https_proxy="http://127.0.0.1:1087"