'How to stop homebrew automatically upgrading postgresql

The brew upgrade command upgrades all packages, so if postgresql is installed with homebrew, the package can be upgraded to a new version incompatible with your databases. How do I prevent this from happening?



Solution 1:[1]

Homebrew can be used to pin a package to its existing version, so if you are using version 12, you can pin it using

brew pin postgresql@12

You need to do this for each major version you are using. If later on, you wish to upgrade then you can do

brew unpin postgresql@12

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Obromios