玩Linux的同學都知道apt-get
、yum
、rpm
包管理方式。當然诈乒,在Macintosh也有一款較為出色的工具------brew(Homebrew)
簡單的安裝
進入 Homebrew官網(wǎng) ,可以看到brew官網(wǎng)提供了簡單的安裝命令
/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
- 顯示已安裝應(yīng)用
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
清理舊版本
- 查看可清理的舊版本婆芦,不執(zhí)行實際操作
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怕磨、查詢已安裝的應(yīng)用及軟件識別碼
命令: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 網(wǎng)易有道詞典 (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、搜索應(yīng)用
命令:mas search 應(yīng)用名
演示:
aiuiot:~ aiuiot$ mas search qq
451108668 QQ (6.5.2)
595615424 QQ音樂 (6.0.0)
435883242 iDown - 迅雷,快車,QQ旋風下載地址解密工具 (1.2)
1178458919 QQ瀏覽器 Lite - 極速安全上網(wǎng)瀏覽器 (1.2.5)
4消约、安裝應(yīng)用
命令:mas install 應(yīng)用識別碼
演示:
aiuiot:~ aiuiot$ mas install 451108668
==> Downloading QQ
==> Installed QQ
查詢待更新的應(yīng)用
命令:mas outdated
演示:
aiuiot:~ aiuiot$ mas outdated
1121484812 有道云筆記 (3.4.1 -> 3.4.2)
6肠鲫、更新應(yīng)用
命令:mas upgrade 應(yīng)用識別碼
演示
mas upgrade 1121484812
Upgrading 1 outdated application:
有道云筆記 (3.4.2)
==> Downloading 有道云筆記
==> Installed 有道云筆記
7、更新所有應(yīng)用
命令:mas upgrade
演示:
aiuiot:~ aiuiot$ mas upgrade
Everything is up-to-date