安装脚本
Mac 标准安装脚本(推荐,功能全面,速度略慢):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Mac 极速安装脚本(安装快,但 update 功能需要命令修复):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed
Linux 标准安装脚本:
rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh
Mac 卸载脚本:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
Linux 卸载脚本:
rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh
替换为国内源
# brew 本体
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# homebrew-core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# homebrew-cask
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
可用镜像源
| 源 | 地址 |
|---|---|
| 中科大 | https://mirrors.ustc.edu.cn/brew.git |
| 清华 | https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git |
| 阿里 | https://mirrors.aliyun.com/homebrew/brew.git |
| 腾讯 | https://mirrors.cloud.tencent.com/homebrew/brew.git |
常见问题
Git 报 dubious ownership 时,把目录加入安全列表:
git config --global --add safe.directory <目录路径>