安装配置
可以安装官网方式进行安装,不过国内安装多数情况下都会安装失败
解决方案:更换镜像安装
安装:
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
配置:
# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
参考:https://brew.idayer.com/guide/change-source/
常用指令
查看镜像源:
git -C "$(brew --repo)" remote get-url origin
git -C "$(brew --repo homebrew/core)" remote get-url origin
git -C "$(brew --repo homebrew/cask)" remote get-url origin
修改镜像源:
# 修改配置
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
# 替换 Homebrew-bottles
# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
- 官方:
https://github.com/Homebrew/
- 中科大:
https://mirrors.ustc.edu.cn/
- 清华:
https://mirrors.tuna.tsinghua.edu.cn/
还不快抢沙发