你可能尝试了很多办法去安装brew,从一开始的网络超时,到一脸蒙的手动安装,本文教你如何正确安装brew
打开你的终端执行下面的命令,进行创建Homebrew
sudo mkdir /usr/local/Homebrew
sudo git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git /usr/local/Homebrew
sudo ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew
sudo mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
sudo git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
sudo mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
sudo git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
sudo chown -R $(whoami) /usr/local/Cellar
sudo chown -R $(whoami) /usr/local/Homebrew
brew -v
此时你安装东西的话,还是会感受到超时的力量,所以我们需要更换国内镜像源
cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
echo ‘export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles‘ >> ~/.bash_profile
source ~/.bash_profile #刷新
echo ‘export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles‘ >> ~/.zshrc
source ~/.zshrc #刷新
记得要更新
brew update
原文:https://www.cnblogs.com/feng0815/p/14433803.html