homebrew

逆流者 2020年01月08日 74次浏览

1.简介

homebrew, 简称brew, 一款mac使用的软件管理工具

2.更新源

# 查看源(进入相应的目录)
git remote -v
# 替换brew.git:
cd "$(brew --repo)"
# 中科大:
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华:
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.ustc.edu.cn/homebrew-core.git
# 清华:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替换homebrew-bottles:
# 中科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 清华:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 更新brew 
brew update

3.基本命令

# 安装软件包
brew install 'name'    
# 卸载软件包
brew uninstall 'name'    
# 查询软件包
brew search 'keyword'    
# 列出已安装的软件包
brew list 或 brew ls 或 brew ls -l  
# 更新brew  
brew update    
# 用浏览器打开brew的官方网站
brew home    
# 显示软件信息
brew info    
# 显示包依赖
brew deps