官方的说法是 macOS
缺失的软件包管理器,个人认为这也许是 macOS
上最好的包管理器。
简介
The missing package manager for macOS.
安装
1
| $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
卸载
1
| $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
|
当然也可以下载 卸载脚本,然后运行 ./uninstall --help
去查看更多卸载选项。
更新公式
其它操作
查找过期的包
升级包
1
2
3
4
5
| // 升级所有的包
$ brew upgrade
or
// 升级指定的包
$ brew upgrade <formula>
|
安装某个包
1
| $ brew install <formula>
|
卸载某个包
1
| $ brew uninstall <formula>
|
清理
By default, Homebrew does not uninstall old versions of a formula, so over time you will accumulate old versions.
1
2
3
4
5
| // 清理指定的包
$ brew cleanup <formula>
or
// 清静所有的包
$ brew cleanup
|
破坏的链接清除
快速预览文件内容插件
Quick Look plugins
1
| $ brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
|
不能更新的问题
Cannot “brew update” anymore
fails to git pull formulas
1
2
3
4
| $ cd `brew --prefix`
$ git remote add origin https://github.com/mxcl/homebrew.git
$ git fetch origin
$ git reset --hard origin/master
|
其它问题
不能安装低版本 PHP 问题
1
2
3
4
5
6
| $ brew install php@7.3
Running `brew update --auto-update`...
Error: php@7.3 has been disabled because it is a versioned formula!
$ brew tap shivammathur/php
$ brew install shivammathur/php/php@7.3
|