Homebrew
Homebrew source code repository (brew upate)
Replace USTC Mirror:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
Reset to the official address:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
Homebrew pre-compiled binary packages
For zsh users:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
For bash users:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
asl
cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
alias
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
# Or alias it in .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
Ruby
RVM
echo "ruby_url=https://cache.ruby-china.com/pub/ruby" > ~/.rvm/user/db
RubyGems
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem sources -l
https://gems.ruby-china.com
# 确保只有 gems.ruby-china.com
Use Bundler and Gemfile
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
So you do not have to change the source of your Gemfile.