...menustart
...menuend
$ cd $(brew --repo)/Library/Taps/homebrew/homebrew-core/
$ git reset --hard HEAD
- use
brew --cache
to find the cache folder - homebrew use
brew --cache
\downloads folder to keep downloaded files- and use
ln -s
to make a reference atbrew --cache
folder
- and use
- 目标文件 可以通过如下命令获得
brew --cache [-s] <package_name>
( -s means from source , not bottle )
替换现有上游:
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
恢复官方
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
brew update
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
- 先下载 brew install 文件 ( 安装命令的 curl 那一段 ), 保存为
brew_install
-
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze CORE_TAP_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze
ruby brew_install
安装- 安装完成后,替换homebrew源
brew update