HomeBrew是什么?
详情见官网
HomeBrew是一款Mac OS平台下的软件管理工具,可以通过简单的命令安装、卸载、升级、管理软件。
安装HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
在终端输入以上命令,根据提示进行操作。
HomeBrew安装完成后,会在/usr/local下生成一个HomeBrew目录,
/usr/local/Homebrew
提供一个brew
命令在/HomeBrew/bin目录下,
jockie:/usr/local/Homebrew/bin (stable)$ ls
brew
并且在/usr/local/bin下生成一个链接
jockie:/usr/local/bin$ ll brew
lrwxr-xr-x 1 jockie admin 28B Jun 3 2017 brew -> /usr/local/Homebrew/bin/brew
brew管理软件
- 查看brew命令
jockie:~$ brew Example usage: brew search [TEXT|/REGEX/] brew (info|home|options) [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install -vd FORMULA Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] https://docs.brew.sh/Formula-Cookbook.html Further help: man brew brew help [COMMAND] brew home
常用命令
安装软件: brew install PKG_NAME
卸载软件: brew uninstall PKG_NAME
升级软件: brew upgrade PKG_NAME
更新brew: brew update
查看帮助: brew help
说明:具体哪条命令不清楚,可以用帮助命令,比如查看update怎么使用,有没有什么参数:
jockie:~$ brew update --help
brew update [--merge] [--force]:
Fetch the newest version of Homebrew and all formulae from GitHub using
git(1) and perform any necessary migrations.
If --merge is specified then git merge is used to include updates
(rather than git rebase).
If --force (or -f) is specified then always do a slower, full update check even
if unnecessary.
或者
jockie:~$ brew help update
brew update [--merge] [--force]:
Fetch the newest version of Homebrew and all formulae from GitHub using
git(1) and perform any necessary migrations.
If --merge is specified then git merge is used to include updates
(rather than git rebase).
If --force (or -f) is specified then always do a slower, full update check even
if unnecessary.
总结
通过brew方式,使我们在macOS系统下能够方便的管理软件。在使用brew的过程中,遇到不熟悉的命令,最简单的方式就是通过help方式查看具体操作信息。