homebrew
Homebrew
安装
1 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
卸载
1 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" |
y
brew help
brew list
brew cask list
brew cask install cakebrew
然后把homebrew-core的镜像地址也设为中科院的国内镜像
cd “$(brew –repo)”
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
执行更新,成功:
brew update
最后用这个命令检查无错误:
brew doctor
这样海外和已经有系统全局代理设置的朋友们就可以直接使用 brew 命令安装软件了。
接着换源:
直接使用 Homebrew 还需要更改默认源,不然谁用谁想打人,原因你懂的。以下是将默认源替换为国内 USTC 源的方法。
替换核心软件仓库
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)
cd “$(brew –repo)”/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换 Bottles 源(Homebrew 预编译二进制软件包)
bash(默认 shell)用户:
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