To start using Homebrew Cask, you just need Homebrew installed.
Homebrew Cask is implemented as part of Homebrew. All Homebrew Cask commands begin with brew, which works for both Casks and Formulae. The most frequently-used commands are:
1.install — installs the given Cask
2.uninstall — uninstalls the given Cask
3.reinstall — reinstalls the given Cask
4.list --casks — lists installed Casks
Homebrew Cask 不需要再单独安装了,新版的 Homebrew 已经整合了 Cask 全部的功能,不仅如此,在安装 Cask 时,也不再需要使用类似 brew cask
这样命令,一律使用命令 brew
即可,理解下面这句话:
All Homebrew Cask commands begin with brew, which works for both Casks and Formulae.
Homebrew Cask 的项目主页地址:https://github.com/Homebrew/homebrew-cask
How to Use Homebrew Cask:https://github.com/Homebrew/homebrew-cask/blob/master/USAGE.md#how-to-use-homebrew-cask
“To install, drag this icon…” no more!
Homebrew Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.
We do this by providing a friendly CLI workflow for the administration of macOS applications distributed as binaries.
Homebrew Cask
相当于 Homebrew
的扩展,区别在于,brew
命令首先获取程序源码然后编译安装(包括依赖库),并自动做好必要的配置(如环境变量等);而 brew cask
命令是下载已经编译好的软件包并放在统一的目录中。
brew cask
命令用来安装 Mac 上的 Gui 程序应用包(.dmg
或 .pkg
),比如 qq、chrome 等。它先下载解压软件包到统一的目录中(/opt/Homebrew Cask/Caskroom
),省掉了自己去下载、解压、拖拽(安装)等步骤。然后再软链到 ~/Applications/
目录下, 非常方便,而且还包含很多在 AppStore 里没有的常用软件。
Homebrew Cask
是将应用程序放置在 /opt/Homebrew Cask/Caskroom/
下,会在你的家目录中的『应用程序』文件夹中创建一个类似快捷方式的替身。
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew tap phinze/Homebrew Cask && brew install brew-cask
Updating Homebrew...
Error: phinze/cask was moved. Tap homebrew/cask instead.
+++++++++++++++++++++++++++++++++
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew tap homebrew/cask && brew install brew-cask
Warning: No available formula or cask with the name "brew-cask". Did you mean brew-pip?
==> Searching for similarly named formulae...
These similarly named formulae were found:
brew-cask-completion ✔ brew-pip
To install one of them, run (for example):
brew install brew-cask-completion ✔
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew cask search chrome
Error: Unknown command: cask
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew -cask search chrome
Error: Unknown command: -cask
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew --cask search chrome
Error: Unknown command: --cask
++++++++++++++++++++
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew install caskroom/cask/brew-cask
Error: caskroom/cask was moved. Tap homebrew/cask instead.
++++++++++++++++++
liaowenxiongdeMacBook-Air:~ liaowenxiong$ brew tap caskroom/cask && brew install brew-cask
Error: caskroom/cask was moved. Tap homebrew/cask instead.
利用官网文件安装
Homebrew Cask-master.zip
压缩包,解压后将文件夹名改为 Homebrew Cask
/usr/local/Homebrew/Library/Taps/homebrew
中,与 homebrew-core
文件夹同级Homebrew Cask
安装homebrew
目录:cd "$(brew --repo)/Library/Taps/homebrew/"
Homebrew Cask
:mkdir Homebrew Cask
git clone git://mirrors.ustc.edu.cn/Homebrew Cask.git /usr/local/Homebrew/Library/Taps/homebrew/Homebrew Cask
cd "$(brew --repo)/Library/Taps/homebrew/Homebrew Cask"
git remote set-url origin https://mirrors.ustc.edu.cn/Homebrew Cask.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/Homebrew Cask.git