PostGIS marks PostgreSQL as a dependency. As I write this Postgres 10 has just been released, but we don't yet want that as it'd be far ahead of Heroku Postgres.
To be able to install a valid PostGIS for 9.6.2 we need to do something like this:
% cd $(brew --repo homebrew/core)
% git log --all --grep='postgresql 9.6.2'
commit 94765b493a3b9f3137061f5dc48f43938dfa5490
Author: Alexander Hamann <[email protected]>
Date: Thu Feb 9 17:18:06 2017 +0100
postgresql 9.6.2
% git checkout 94765b493
% HOMEBREW_NO_AUTO_UPDATE=1 brew install postgis
I also needed to recompile a bunch of dependencies to get the database schema I was working with to import. I'm unsure if this is related to the experimentation I did or otherwise, but:
% HOMEBREW_NO_AUTO_UPDATE=1 brew reinstall gdal -s
% HOMEBREW_NO_AUTO_UPDATE=1 brew reinstall libgeotiff -s
% HOMEBREW_NO_AUTO_UPDATE=1 brew reinstall libtiff -s
Compiling libtiff
from source was …quite difficult. The version at this point in time was 4.0.7
but that's been superseded by 4.0.8
and the original cleared from the mirrors. I manually updated the Formula from the 4.0.8 Homebrew PR and then I could reinstall it.
Of course, if you'd already had postgis
installed you could just do brew switch postgis 2.3.2
…but I didn't.