Installing in Cellar


(Steven Leiva) #1

Hi folks,

I have Postgres installed via Homebrew, on version 9.6.

I upgraded Postgres, and brew correctly installed version 10.

However, I still needed to run Postgres 9.6 on occasion, so installed version 9.6 brew install postgres@9.6.

Now, when I run brew search postgresql, I see that I have both versions installed:

==> Searching local taps...
postgresql ✔                                    postgresql@9.6 ✔    

Then, I tried to switch to version 9.6 by doing brew switch postgresql 9.6, and I was greeted with this error:

Error: postgresql does not have a version "9.6" in the Cellar.
postgresql installed versions: 10.4

I don’t know what the correct way to fix this is. I was in a rush, so after scanning the homepage quickly, I went into the /user/local/Cellar directory, and copied /user/local/Cellar/postgres@9.6/9.6.9 into /user/local/Cellar/postgresql (I might have gotten the directory names confused a bit, but I think you all get what I am saying) and that “fixed” things.

Can someone explain to me what I did wrong? How should I have downloaded version 9.6 in order to get it into the Cellar?


(Sean Molenaar) #2

Think of postgresql@9.6 as a different program. Brew doesn’t link it to the bin directory by default because it’s an old version, the same protection it uses for formulae of things that are shipped with macOS.
The official way to add postgresql@9.6 to your path instead of postgresql would be to brew unlink postgresql and then brew link postgresql@9.6.