入坑指南 | macOS上贼好用的包管理器brew
2019-03-19 本文已影响0人
Deque
玩Linux的同学都知道apt-get
、yum
、rpm
包管理方式。当然,在Macintosh也有一款较为出色的工具------brew(Homebrew)
简单的安装
进入 Homebrew官网 ,可以看到brew官网提供了简单的安装命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
基本操作
- 查看brew版本信息
brew -v
aiuiot:~ aiuiot$ brew -v
Homebrew 2.1.6
Homebrew/homebrew-core (git revision 14345; last commit 2019-07-07)
Homebrew/homebrew-cask (git revision c445a; last commit 2019-07-07)
- 查看帮助信息
brew -h
或者brew help
aiuiot:~ aiuiot$ brew -h
Example usage:
brew search [TEXT|/REGEX/]
brew info [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA
Contributing:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.sh
- 显示已安装应用
brew list
aiuiot:~ aiuiot$ brew list
gradle openssl ruby
libyaml readline
更新操作
- 更新brew
brew update
aiuiot:~ aiuiot$ brew update
Updated 1 tap (homebrew/core).
==> Updated Formulae
argus-clients cmake gtk+3 phpunit
chronograf grafana pango
- 查询可更新的包(软件)
brew outdated
aiuiot:~ aiuiot$ brew outdated
libyaml (0.2.1) < 0.2.2
ruby (2.6.1) < 2.6.2
3.更新所有软件brew upgrade
aiuiot:~ aiuiot$ brew upgrade 1443 23:09:32
==> Upgrading 2 outdated packages:
libyaml 0.2.1 -> 0.2.2, ruby 2.6.1 -> 2.6.2
==> Upgrading ruby
==> Installing dependencies for ruby: libyaml
==> Installing ruby dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0
清理旧版本
- 查看可清理的旧版本,不执行实际操作
brew cleanup -n
aiuiot:~ aiuiot$ brew cleanup -n
Would remove: /usr/local/Cellar/readline/7.0.5 (46 files, 1.5MB)
Would remove: /usr/local/Cellar/ruby/2.6.0 (19,334 files, 32.3MB)
==> This operation would free approximately 33.8MB of disk space.
- 清理指定包的旧版本
brew cleanup [包名]
aiuiot:~ aiuiot$ brew cleanup ruby
3.清理所有包的旧版本brew cleanup
aiuiot:~ aiuiot$ brew cleanup
Removing: /usr/local/Cellar/readline/7.0.5... (46 files, 1.5MB)
Removing: /usr/local/Cellar/ruby/2.6.0... (19,334 files, 32.3MB)
Pruned 11 symbolic links and 9 directories from /usr/local
==> This operation has freed approximately 33.8MB of disk space.
安装mas
aiuiot:~ aiuiot$ brew install mas
==> Downloading https://homebrew.bintray.com/bottles/mas-1.6.2.mojave.bottle.tar
######################################################################## 100.0%
==> Pouring mas-1.6.2.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/mas/1.6.2: 39 files, 11.6MB
2、查询已安装的应用及软件识别码
命令:mas list
演示:
aiuiot:~ aiuiot$ mas list
1127253508 DrUnarchiver (1.3.3)
451108668 QQ (6.5.2)
441258766 Magnet (2.4)
409183694 Keynote (8.3)
491854842 网易有道词典 (2.3.4)
406056744 Evernote (7.5.1)
425955336 Skitch (2.8.2)
1121484812 YoudaoNote (3.4.1)
1173152781 Notebook (4.1.5)
1055511498 Day One (2.9.2)
408937559 iFlicks (2.6.3)
1071663619 unrarpro2 (1.8)
1287445660 Agenda (4.0)
409201541 Pages (7.3)
414675434 SPlayerX (1.2.6)
784260229 PicGIF (2.0.8)
409203825 Numbers (5.3)
449814591 CHM View (2.4.0)
1333542190 1Password 7 (7.2.4)
3、搜索应用
命令:mas search 应用名
演示:
aiuiot:~ aiuiot$ mas search qq
451108668 QQ (6.5.2)
595615424 QQ音乐 (6.0.0)
435883242 iDown - 迅雷,快车,QQ旋风下载地址解密工具 (1.2)
1178458919 QQ浏览器 Lite - 极速安全上网浏览器 (1.2.5)
4、安装应用
命令:mas install 应用识别码
演示:
aiuiot:~ aiuiot$ mas install 451108668
==> Downloading QQ
==> Installed QQ
查询待更新的应用
命令:mas outdated
演示:
aiuiot:~ aiuiot$ mas outdated
1121484812 有道云笔记 (3.4.1 -> 3.4.2)
6、更新应用
命令:mas upgrade 应用识别码
演示
mas upgrade 1121484812
Upgrading 1 outdated application:
有道云笔记 (3.4.2)
==> Downloading 有道云笔记
==> Installed 有道云笔记
7、更新所有应用
命令:mas upgrade
演示:
aiuiot:~ aiuiot$ mas upgrade
Everything is up-to-date