Installing Django PostGIS Postgres on OS X: Version Hell

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:

  1. 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!
  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)
  3. postgis1.5 doesn’t play well with postgresql9.2.1, so you to install postgresql9.1.x (http://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS)
  4. So, the working versions to use together would be Django1.4.x with postgis1.5 and postgres9.1.x
  5. 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
  6. The crazy thing is trying to `brew install postgis15` gives me the following error [1]
  7. 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.
  8. 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!
  9. `brew doctor` is your friend

[1]

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
==> make
num2_tuples = reltup->reltuples;
^
4 errors generated.
make[1]: *** [lwgeom_estimate.o] Error 1
make: *** [postgis] Error 2

Other Useful Links

http://blog.dyve.net/upgrade-your-mac-to-postgres-9-using-homebrew

http://stackoverflow.com/questions/12547872/trouble-installing-postgis-postgresqldjangomac-os-x-10-7

http://gibuloto.com/blog/install-postgresql-in-mac-osx-lion/

https://gist.github.com/3188632

http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula

About these ads

6 thoughts on “Installing Django PostGIS Postgres on OS X: Version Hell

      • I was trying to build a development of openblock, firstly everything was cool, before trying to install Django. My error messages were “[plpython2.so] Error 1″ , so I fix it by using “–no-python”, then it came out error message of “[uuid-ossp.o] Error 1″. I finally build it like this: “brew install postgresql9 –no-python –without-ossp-uuid”. And it works!
        I was justing wondering how it happened. And now it drives me crasy when i was setting openblock. Maybe I need to redo these in macport too.
        Thanks for replying!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s