brew

最后更新于:2022-04-02 03:45:25

[TOC] ## 安装 ### 官方安装 `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ` ### 通过镜像安装 [安装说明](https://zhuanlan.zhihu.com/p/90508170) ``` /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)" // 卡在 core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... //执行 cd "$(brew --repo)/Library/Taps/" mkdir homebrew && cd homebrew git clone git://mirrors.ustc.edu.cn/homebrew-core.git // 卡在 cask , 同理 //执行 cd "$(brew --repo)/Library/Taps/" cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-cask.git //再执行 /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)" ``` ## 设置镜像 清华大学源 ``` 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 ``` ## brew services 服务管理 ``` brew services Name Status User Plist beanstalkd stopped httpd started root /Library/LaunchDaemons/homebrew.mxcl.httpd.plist memcached stopped ... ``` ``` 列出服务 [sudo] brew services [list] 非注册服务方式启动 [sudo] brew services run (服务名|--all) [sudo] brew services start (服务名|--all) [sudo] brew services stop (服务名|--all) [sudo] brew services restart (服务名|--all) 移除所有在跑的服务 [sudo] brew services cleanup ``` ## 命令 ``` brew search git 搜索 brew install git 安装 brew uninstall git 卸载 brew upgrade git 升级 brew info git 查看信息 brew cleanup git 清楚老版本 // link brew unlink git Unlink brew link git Link 把命令软连接到 /usr/local/bin brew list --versions git 查看版本 brew switch git 2.5.0 切换版本 //cask brew cask install firefox 安装界面应用 brew cask list 列出安装应用 // tap brew tap 如仓库为 idcpj/homebrew -> brew tap idcpj/tap brew untap user/repo 取消仓库 brew tap-pin user/repo 首选搜索库 brew tap-unpin user/repo 取消首选搜索库 //global brew outdated 检查老版本 brew upgrade 更新所有应用 brew cleanup 删除应用的旧版本和缓存删除 brew doctor 检查 brew list 列出安装应用 brew services 类似linux的方式管理 ```
';