个人常用镜像

mac2022-06-30  116

Homebrew

Homebrew 源代码仓库 (brew upate)

替换USTC镜像:

cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

重置为官方地址:

cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git

Homebrew 预编译二进制软件包

对于 zsh 用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc

对于 bash 用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile

npm

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

使用 Gemfile 和 Bundler

bundle config mirror.https://rubygems.org https://gems.ruby-china.com

这样你不用改你的 Gemfile 的 source。

转载于:https://www.cnblogs.com/CodeAndMoe/p/mirror.html

最新回复(0)