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 for this gist, really !
Worth to note that now (sept 2012) homebrew ships postgresql 9.2 under "postgresql", and this version is NOT compatible with PostGIS 1.5 (see http://trac.osgeo.org/postgis/ticket/1995 )
So to make this work, I had to brew install postgresql9 (which links to 9.0.8) and edit the postgis15 formula to link it to this package.