Install Homebrew
Install a few things with homebrew:
Notice that some packages give you information at the end, read it carefully. To recall that info use brew info
like this: $ brew info postgresql
$ brew install python --universal
Note: if you plan on running graphical apps with this python installation add --framework
as well.
Some geo dependencies:
Django doesn't currently work with Postgis 2.x, so we have to install 1.5.x (see ticket #16455). Also, PostGis 1.5 does not work with Postgres 9.2, so we are going to install v9.0.8
$ brew tap homebrew/versions
$ brew install postgis15
$ brew install postgresql9
$ brew untap homebrew/versions
$ brew install gdal geos
Create the template_postgis
template database
$ createdb template_postgis
$ psql -f /usr/local/share/postgis/postgis.sql template_postgis
$ psql -f /usr/local/share/postgis/spatial_ref_sys.sql template_postgis
Create a new db:
$ createdb -T template_postgis mydatabase
Dump/Restore:
$ pg_dump -Fc mydatabase > /tmp/mydatabase.db
$ postgis_restore.pl /usr/local/Cellar/postgis/1.5.3/share/postgis/postgis.sql mydatabase /tmp/mydatabase.db
Thanks @fcurella. This saved me a lot of time. I had a few additional problems getting Geodjango/PostGIS running on Mac OS X, which I wrote up in case other people run into them: http://stackoverflow.com/questions/3567352/geodjango-syncdb-errors-from-geodjango-tutorial/14221129#14221129