#官网安装脚本
/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)"
#国内卸载脚本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
#安装:
brew install xxx
#安装包
brew install --cask xxx
#卸载:
brew uninstall xxx
#搜索:
brew search xxx
#检查哪些软件需要更新
brew outdated
#更新:
brew upgrade xxx
#列表:
brew list
#更新brew:
brew update
#清理所有旧版本包
brew cleanup
#清理指定包的旧版本
brew cleanup $FORMULAE
#查看可清理的旧版本包,不执行实践操作
brew cleanup -n
#启动
brew services start xxx
#停止
brew services stop xxx
#重启
brew services restart xxx
#取消安装时自动更新(写入配置到.zsh或者.bash_profile)
echo 'export HOMEBREW_NO_AUTO_UPDATE=true' >> ~/.bash_profile
source ~/.bash_profile
#替换现有源
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update
#还原为官方源
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
brew update
brew cask 和 formulae的区别
- Formulae:软件包,包括了这个软件的依赖、源码位置及编译方法等;
- Casks:已经编译好的应用包,如图形界面程序等。