← Back to all posts
Environment Setup1 min read

Switch Homebrew to Chinese Mirrors on macOS

Switch Homebrew repositories, package repositories, and Bottles repositories to Chinese mirrors on macOS.

Read in Chinese→

Switch Homebrew to Chinese Mirrors on macOS

Homebrew repository

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

Package repository

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

Bottles repository

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