yum install -y zsh

chsh -s /bin/zsh

mkdir /usr/local/Homebrew

git clone http://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git /usr/local/Homebrew

ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew

mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
 
git clone http://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git clone http://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

mdkir /usr/local/Cellar
chown -R $(whoami) /usr/local/Cellar

查看版本号
brew -v

此时你安装时超时更换国内镜像源 替换homebrew默认源
cd "$(brew --repo)"
 
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git

bash用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=http://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
 
source ~/.bash_profile   #刷新

zsh用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=http://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
 
source ~/.zshrc     #刷新

brew update