快速安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"国内用户推荐(更快):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"配置国内镜像源
清华大学镜像源(推荐)
# 替换brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换homebrew-cask.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 配置bottles镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
# 更新
brew update常用命令
软件包管理
# 搜索软件
brew search <软件名>
# 安装命令行工具
brew install <软件名>
# 安装GUI应用
brew install --cask <应用名>
# 卸载软件
brew uninstall <软件名>
# 更新所有软件
brew upgrade
# 清理缓存
brew cleanup使用示例
# 开发工具
brew install git node python3 go
# GUI应用
brew install --cask visual-studio-code google-chrome pycharm
# 查看已安装
brew list
brew list --cask故障排除
# 诊断问题
brew doctor
# 重新安装
brew reinstall <软件名>
# 查看软件信息
brew info <软件名>参考资料: 清华大学开源软件镜像站