阿里雲鏡像:
# 配置 Homebrew 核心鏡像
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 配置 Homebrew 公式鏡像
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 配置 Homebrew cask 鏡像
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git
# 配置 Homebrew Bottles 鏡像
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew-bottles
中科大鏡像:
# 配置 Homebrew 核心鏡像
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 配置 Homebrew 公式鏡像
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 配置 Homebrew cask 鏡像
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# 配置 Homebrew Bottles 鏡像
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
清華大學鏡像:
# 配置 Homebrew 核心鏡像
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 配置 Homebrew 公式鏡像
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 配置 Homebrew cask 鏡像
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 配置 Homebrew Bottles 鏡像
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
查看配置
brew config
更新Homebrew
# 更新
$ brew update
# 升級到最新的 Homebrew
$ brew upgrade
常用命令
# 搜索軟件包
brew search package_name
# 安裝軟件包
brew install package_name
# 卸載軟件包
brew uninstall package_name
# 查看已安裝的軟件包
brew list
# 清理過期的軟件包
brew cleanup # 清理所有包的舊版本
brew cleanup [FORMULA ...] # 清理指定包的舊版本
brew cleanup -n # 查看可清理的舊版本包,不執行實際操作
默認配置(官網源)
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
export HOMEBREW_BOTTLE_DOMAIN=https://homebrew.bintray.com