I’m an avid user of Homebrew on macOS.
Doing an updates rightly updates all software installed through Homebrew to their latest version as expected. But, sometimes, you might want to install the previous version of a program. Here is the correct way to do it courtesy of variar on Stack Overflow:
TAP=... # <org>/<repo>, for example "my-org/homebrew-old" MODULE=... # name of module you want to install, e.g. "hugo" VERS=... # version of $MODULE you want to install, e.g., "0.80.0" brew tap-new $TAP brew extract --version $VERS $MODULE $TAP brew install $TAP/$MODULE@$VERS
An example without using the shell variables is as follows:
brew tap-new avinash/homebrew-old brew extract --version 2.51.3 unison avinash/homebrew-old brew install avinash/homebrew-old/unison@2.51.3
The first command creates a new tap called avinash/homebrew-old and this needs to be done only once.
This will install a previous version of unison, version 2.51.3. Incidentally, to obtain the list of versions of a specific Homebrew program (called a formula), you can use this excellent search feature of Github.