安装依赖
sudo apt-get install build-essential procps curl file git
安装brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>
$HOME/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
修改镜像源
查看源
//查看 brew.git 当前源
cd "$(brew --repo)" && git remote -v
//查看 homebrew-core.git 当前源
cd "$(brew --repo homebrew/core)" && git remote -v
替换源
//替换brew.git:
cd "$(brew --repo)" && git remote set-url origin https://mirrors.ustc.edu.cn/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
//替换homebrew-cask.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
刷新源
brew update
常用命令
//查看brew的版本
brew -v
//更新homebrew自己,把所有的Formula目录更新,并且会对本机已经安装并有更新的软件用*标明
brew update
//查看那些已安装的程序需要更新
brew outdated
//更新单个软件:
brew upgrade [包名]
//更新所有软件:
brew upgrade
//安装软件
brew install [包名]@版本
//卸载
brew uninstall [包名]
//清理所有包的旧版本 (安装包缓存)
brew cleanup
-n //显示要删除的内容,但不要实际删除任何内容
-s //清理缓存,包括下载即使是最新的版本
--prune=1 //删除所有早于指定时间的缓存文件(天)
//清理单个软件旧版本
brew cleanup [包名]
//查看需要更新的包
brew outdated
//查看可清理的旧版本包,不执行实际操作
brew cleanup -n
//锁定某个包
brew pin $FORMULA
//取消锁定
brew unpin $FORMULA
//查看包信息
brew info [包名]
//查看安装列表
brew list
//查询可用包
brew search [包名]
//显示包依赖
brew deps [包名]
--installed //所有安装的包
--tree //以树表示