在使用官方的命令进行安装是,会有些速度慢。可以通过下面的方式进行安装
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)" # 然后根据提示设置环境变量 echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/lh.hc/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" # 查看是否安装完成 which brew
安装完成后,设置 brew 的镜像源,我这里以阿里云的镜像源为例,我的默认 shell 为 zsh
echo $SHELL
# 替换brew.git: cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # 替换homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # 应用生效 brew update # 替换homebrew-bottles: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
设置阿里镜像源的参考:https://developer.aliyun.com/mirror/homebrew