

# brew deprecated commands



- switch





#### Activer une autre version:

```bash
$ brew switch <formula>
```

```bash
bruno@SilverBook:/usr/local/Cellar/terminal-notifier/1.8.0$ brew switch terminal-notifier 1.7.1

Cleaning /usr/local/Cellar/terminal-notifier/1.7.1

Cleaning /usr/local/Cellar/terminal-notifier/1.8.0

1 links created for /usr/local/Cellar/terminal-notifier/1.7.1
```

#### Installer une ancienne version d'une formule:

Exemple avec [annie](https://github.com/iawia002/annie), un téléchargeur de vidéo.  La version courante est la dernière (0.9.6)

```bash
~ master*
❯ annie -v

annie: version 0.9.6, A fast, simple and clean video downloader.
```



```bash
~ master*
❯ cd "$(brew --repo homebrew/core)"
```



```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master
❯ git log Formula/annie.rb
commit 377c142a619f2b2563c4c01b06f2560707fa3228
Author: BrewTestBot <homebrew-test-bot@lists.sfconservancy.org>
Date:   Fri Nov 8 10:23:24 2019 +0000

    annie: update 0.9.6 bottle.

commit e3201eb44c3eade6f113f616b67315ae13f5a70b
Author: iawia002 <xuxinzhao@caicloud.io>
Date:   Fri Nov 8 18:15:49 2019 +0800

    annie 0.9.6

    Closes #46491.

    Signed-off-by: Rui Chen <rchen@meetup.com>

commit ef762f724ce45afb0007f7d3b96a8f10ceeb3b58
Author: BrewTestBot <homebrew-test-bot@lists.sfconservancy.org>
Date:   Fri Oct 11 21:56:45 2019 +0000

    annie: update 0.9.5 bottle.

commit 249669ab6a53335d85d8973c8e82f182903434ca
Author: BrewTestBot <homebrew-test-bot@lists.sfconservancy.org>
Date:   Tue Aug 13 14:30:19 2019 +0000

    annie: update 0.9.5 bottle.

commit 5fa1c6903f84cc22c2cbed751de6125cab4fe214
Author: iawia002 <xuxinzhao@caicloud.io>
Date:   Tue Aug 13 22:22:21 2019 +0800

    annie 0.9.5

    Closes #43069.

    Signed-off-by: Thierry Moisan <thierry.moisan@gmail.com>

```

Création d'une nouvelle branche pour l'ancienne version:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master 19s
❯ git checkout -b annie-0.9.5 ef762f724ce45afb0007f7d3b96a8f10ceeb3b58
Basculement sur la nouvelle branche 'annie-0.9.5'
```

Unlink la version courante:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core annie-0.9.5
❯ brew unlink annie
Unlinking /usr/local/Cellar/annie/0.9.6... 1 symlinks removed
```

Installation de la version 0.9.5:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core annie-0.9.5
❯ HOMEBREW_NO_AUTO_UPDATE=1 brew install annie
==> Downloading https://homebrew.bintray.com/bottles/annie-0.9.5.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/06/06ff55a2834ad01a262b66f181a8c99800157ec0f465f80e0cc3518be7ebd1da?__gda__=exp=1575195423~hmac=edc063962f1a5b12a715444b0f1eff
######################################################################## 100.0%
==> Pouring annie-0.9.5.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/annie/0.9.5: 5 files, 8.6MB
```

L'ancienne version 0.9.5 est bien active:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core annie-0.9.5
❯ annie -v

annie: version 0.9.5, A fast, simple and clean video downloader.
```

Retour sur la branche 'master'

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core annie-0.9.5
❯ git checkout master
Basculement sur la branche 'master'
Votre branche est à jour avec 'origin/master'.
```

Suppression de l'ancienne branche 0.9.5

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master
❯ git branch -d annie-0.9.5
Branche annie-0.9.5 supprimée (précédemment ef762f72).
```

Liste des versions installés:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master
❯ brew list annie --versions
annie 0.9.6 0.9.5
```

Info sur la formule 'annie'

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master
❯ brew info annie
annie: stable 0.9.6 (bottled)
Fast, simple and clean video downloader
https://github.com/iawia002/annie
/usr/local/Cellar/annie/0.9.5 (5 files, 8.6MB) *
  Poured from bottle on 2019-12-01 at 11:05:06
/usr/local/Cellar/annie/0.9.6 (5 files, 8.6MB)
  Poured from bottle on 2019-12-01 at 10:57:11
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/annie.rb
```

Changement de version:

```bash
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core master
❯ brew switch annie 0.9.6
Cleaning /usr/local/Cellar/annie/0.9.6
Cleaning /usr/local/Cellar/annie/0.9.5
1 links created for /usr/local/Cellar/annie/0.9.6
```

