Ran into a day and half’s worth of trouble while trying to install postgis and I still haven’t resolved it yet. Some things to note so far:
- If you install postgis via brew, `brew install postgis`, it will also automagically install postgresql9.2.1 for you. So if you have a previous version of postgresql installed, you will now have 2!
- Django1.4 doesn’t play will with postgis2.0 for now. So, you have to install postgis1.5 (https://code.djangoproject.com/ticket/16455)
- postgis1.5 doesn’t play well with postgresql9.2.1, so you to install postgresql9.1.x (http://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS)
- So, the working versions to use together would be Django1.4.x with postgis1.5 and postgres9.1.x
- To NOT get the latests version of postgres from brew, follow this gist (https://gist.github.com/3188632) to install postgres9 which will link you to postgres9.08
- The crazy thing is trying to `brew install postgis15` gives me the following error 
- Client version of psql is different from the server version of postgres. If you run psql in terminal and you see something like `psql (9.2.1)`, it means the client and server versions are the same. If you see something like `psql (Client (9.2.1) Server (9.1.2))` (can’t remember the exact phrasing but the first number would be the client, the second number would be the server itself), it means the client and server versions are different.
- If you have a previous version of postgres, you would have had to run `initdb /usr/local/var/postgres`. You gotta move/delete this guy if you’re installing a new version of postgres and rerun the initidb command!
- `brew doctor` is your friend
Error in Question:
nai@nyc ~ $ brew install postgis15
==> Downloading http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
Already downloaded: /Users/nai/Library/Caches/Homebrew/postgis15-1.5.3.tar.gz
==> ./configure –with-projdir=/usr/local –with-pgconfig=/usr/local/Cellar/postgresql/9.2.1/bin/pg_config
num2_tuples = reltup->reltuples;
4 errors generated.
make: *** [lwgeom_estimate.o] Error 1
make: *** [postgis] Error 2
Other Useful Links