34

Homebrew's current version of Postgres is 10 when installed with:

brew install postgres

How do I install an older version of postgres? Specifically 9.6

1 Answer 1

53

You can find available versions to install using brew search:

$ brew search postgresql
==> Searching local taps...
postgresql        [email protected]        [email protected]        [email protected]

To install one of these older versions, pass the full name into brew install:

$ brew install [email protected]

It will give you instructions on how to add that PATH of that particular version to your bash environment, so you can use its psql etc.

If you still have psql booting up a newer version of postgresql, try this:

brew install [email protected]
cp -rf /usr/local/Cellar/[email protected]/9.6.9 /usr/local/Cellar/postgresql/.
brew switch postgres 9.6.9
12
  • 1
    Thanks, will try that. Is 9.6 not available as a named version yet? It only has 9.4 and 9.5 listed.
    – JK.
    Oct 30, 2017 at 20:41
  • 1
    As of today, 9.6 is available.
    – Nate Bird
    Nov 17, 2017 at 15:35
  • 1
    This did install, but I still have no psql commands, and libpq-fe.h library available
    – raarts
    Jan 18, 2018 at 14:03
  • 1
    As of writing (1.6.1), doing brew install [email protected] seems to work, but if you attempt brew info postgresql still points to 10.3 (current stable). Doing brew info [email protected] looks like it works, but one cannot brew switch to it. Still not sure yet how one resolves that. Apr 23, 2018 at 20:05
  • 1
    @Adi Thanks for your edit, though I’m not sure I fully understand it. Can you explain a little more about why that works? Could a symlink be used instead of copying the files?
    – grg
    Oct 5, 2018 at 7:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .