# Homebrew-Cask



**[:fa-link: Homebrew-Cask](https://github.com/caskroom/homebrew-cask)**

**[:fa-link: https://caskroom.github.io](https://caskroom.github.io)**



### Installer un plug-in QuickLook ([:fa-link: QLVideo](https://github.com/Marginal/QLVideo)):

```bash
$ brew cask install qlvideo

# --force	réinstalle le Cask (si déjà présent)
```


### Desinstaller:

```bash
$ brew cask uninstall qlvideo
```


### Liste de tous les Casks disponibles:

```bash
$ brew search
```



### Liste de tous les Casks disponibles à propos de Chrome:

```bash
$ brew cask search chrome
==> Partial Matches
chrome-devtools                 dmm-player-for-chrome           google-chrome
chrome-remote-desktop-host      epichrome                       mkchromecast
==> Remote Matches
caskroom/versions/google-chrome-canary          caskroom/versions/google-chrome-dev
caskroom/versions/google-chrome-beta
```



### Information au sujet d'un Cask:

```bash
$ brew cask info google-chrome
google-chrome: 63.0.3239.132
https://www.google.com/chrome/
Not installed
From: https://github.com/caskroom/homebrew-cask/blob/master/Casks/google-chrome.rb
==> Name
Google Chrome
==> Artifacts
Google Chrome.app (App)
```



### Liste des Casks installés:

```bash
$ brew cask list
basictex                        qlcolorcode                     suspicious-package
betterzipql                     qlstephen

# -1			sortie sur une seule colonne
# --versions	montre toutes les versions installés
```



### Aller à la page du project Homebrew-Cask:

```bash
$ brew cask home
```



### Aller à la page du Cask:

```bash
$ brew cask home {{cask_name}}

$ brew cask home qlstephen
```



### Liste des Casks mis-à-jour disponibles:

```bash
$ brew cask outdated

# --greedy 		inclus les Casks avec auto_updates true et version :latest
# --verbose
```



### Version du Cask:

```bash
$ brew cask _stanza version {{cask_name}}

$ brew cask _stanza version bettertouchtool
2.800
```



### Installer les mises-à-jour:

```bash
$ brew cask reinstall `brew cask outdated`
```



```bash
$ brew cask outdated --greedy --verbose | grep -v '(latest)' | awk '{print $1}' | xargs brew cask reinstall

# mets à jour les auto_updates true mais pas les version :latest
```



### Mettre à jour tous les Casks:

```bash
$ brew cask upgrade

# --greedy		met à jour les Casks avec auto_updates true et version :latest
```



### Script d'installation:

```bash
# !/bin/sh

# Brew packages that I use alot.

brew install wget
brew install ffmpeg
brew install node
brew install imagemagick

# Some cask packages that I like.

brew cask install google-chrome
brew cask install xquartz
brew cask install virtualbox
```

Sauver le script sous le fichier **installConfig.sh** et le rendre exécutable:

```bash
$ chmod +x installConfig.sh
```



### Cache:

```bash
$ cd ~/Library/Caches/Homebrew/Cask
total 480296
drwxr-xr-x  11 bruno  staff        352 18 jan 18:54 .
drwxr-xr-x  92 bruno  staff       2944 17 jan 17:19 ..
-rw-r--r--@  1 bruno  staff   19529710 14 déc 12:30 airy--3.3.179.dmg
-rw-r--r--   1 bruno  staff  135495923 10 jan 01:59 atom--1.23.3.zip
-rw-r--r--   1 bruno  staff   74574230  7 jui  2017 basictex--2017.0607.pkg
-rw-r--r--@  1 bruno  staff    2158705 22 oct 05:23 cakebrew--1.2.5.dmg
-rw-r--r--   1 bruno  staff      28404 26 oct 14:01 qlcolorcode--2.0.9.zip
-rw-r--r--   1 bruno  staff      55479 21 mai  2017 qlmarkdown--1.3.5.zip
-rw-r--r--   1 bruno  staff      30945 24 mai  2017 qlstephen--1.4.4.zip
-rw-r--r--@  1 bruno  staff    5078603 22 mai  2017 transmission--2.92.dmg
-rw-r--r--@  1 bruno  staff    2825054 13 nov 11:03 vnc-viewer--6.17.1113.dmg
```



### Vider le cache:

```bash
# Supprimer tous les téléchargements
$ brew cask cleanup

# Supprimer les téléchargements vieux de + de 10 jours.
$ brew cask cleanup --outdated
```



https://github.com/Homebrew/homebrew-cask/blob/master/doc/development/adding_a_cask.md



### Error: Cask 'handbrake' definition is invalid: invalid 'depends_on macos' value: ":lion": 

```bash
Casks upgrade.
==> Satisfying dependencies
==> Downloading https://download.handbrake.fr/handbrake/releases/1.2.2/HandBrake
Already downloaded: /Users/bruno/Library/Caches/Homebrew/downloads/1916f7da74b033f06aecbb2b38e29c6b769d6d7fc019d26b794b1bb7d8a46aa3--HandBrake-1.2.2.dmg
==> Verifying SHA-256 checksum for Cask 'handbrake'.
Error: Cask 'handbrake' definition is invalid: invalid 'depends_on macos' value: ":lion"
```

Supprimer l'application HandBrake manuellement, puis:

```
$ rm -rvf "$(brew --prefix)/Caskroom/handbrake"
/usr/local/Caskroom/handbrake/.metadata/1.2.0/20181224200347.982/Casks/handbrake.rb
/usr/local/Caskroom/handbrake/.metadata/1.2.0/20181224200347.982/Casks
/usr/local/Caskroom/handbrake/.metadata/1.2.0/20181224200347.982
/usr/local/Caskroom/handbrake/.metadata/1.2.0
/usr/local/Caskroom/handbrake/.metadata
/usr/local/Caskroom/handbrake/1.2.0/doc/LICENSE
/usr/local/Caskroom/handbrake/1.2.0/doc/AUTHORS.markdown
/usr/local/Caskroom/handbrake/1.2.0/doc/README.markdown
/usr/local/Caskroom/handbrake/1.2.0/doc/COPYING
/usr/local/Caskroom/handbrake/1.2.0/doc/THANKS.markdown
/usr/local/Caskroom/handbrake/1.2.0/doc/NEWS.markdown
/usr/local/Caskroom/handbrake/1.2.0/doc
/usr/local/Caskroom/handbrake/1.2.0
/usr/local/Caskroom/handbrake
```

Réinstaller HandBrake

```bash
$ brew cask install handbrake
==> Satisfying dependencies
==> Downloading https://download.handbrake.fr/handbrake/releases/1.2.2/HandBrake-1.2.2.dmg
Already downloaded: /Users/bruno/Library/Caches/Homebrew/downloads/1916f7da74b033f06aecbb2b38e29c6b769d6d7fc019d26b794b1bb7d8a46aa3--HandBrake-1.2.2.dmg
==> Verifying SHA-256 checksum for Cask 'handbrake'.
==> Installing Cask handbrake
==> Moving App 'HandBrake.app' to '/Applications/HandBrake.app'.
```



### Réinstaller une ancienne version de VirtualBox (6.0.6 au lieu de 6.0.8):

Désinstaller la version actuelle:

```bash
$ brew cask uninstall virtualbox
$ brew cask uninstall virtualbox-extension-pack
```

Récupérer la liste des commits:

```bash
$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask log Casks/virtualbox.rb
commit c774b25eee695c3032b6928e646f2118eab8eabf
Author: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com>
Date:   Wed May 15 18:37:37 2019 +0200

		Update virtualbox from 6.0.6,130049 to 6.0.8,130520 (#63302)

commit 28143da5bb1559f734221b6ad6e3cb5b7ab0153f
Author: tiiiecherle <tiiiecherle@gmail.com>
Date:   Wed Apr 17 16:52:59 2019 +0200

		Update virtualbox from 6.0.4,128413 to 6.0.6,130049 (#62035)

.../...
```

Récupérer *la recette* correspondant au commit souhaité:

```bash
$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask checkout 28143da5bb1559f734221b6ad6e3cb5b7ab0153f Casks/virtualbox.rb
```

Installer VirtualBox:

```bash
$ HOMEBREW_NO_AUTO_UPDATE=1 brew cask install virtualbox
```

Faire de même pour l'extension pack:

```bash
$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask log Casks/virtualbox-extension-pack.rb
commit 782591b692eb2592c639a04b580eea82583c956b
Author: tiiiecherle <tiiiecherle@gmail.com>
Date:   Wed May 15 18:38:10 2019 +0200

		Update virtualbox-extension-pack from 6.0.6 to 6.0.8 (#63303)

commit 73f9805759f8de5bd381e6d7c7a559967449b11a
Author: tiiiecherle <tiiiecherle@gmail.com>
Date:   Wed Apr 17 17:01:10 2019 +0200

		Update virtualbox-extension-pack from 6.0.4 to 6.0.6 (#62033)

.../...

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask checkout 70baf19bfe323ecf4a7b7ce0ca6310e01f6a66a4 Casks/virtualbox-extension-pack.rb

$ HOMEBREW_NO_AUTO_UPDATE=1 brew cask install virtualbox-extension-pack

```

