Skip to content

Instantly share code, notes, and snippets.

@andrewschoen
Forked from estebistec/osx_geodjango_deps.sh
Created April 3, 2012 15:34
Show Gist options
  • Save andrewschoen/2292963 to your computer and use it in GitHub Desktop.
Save andrewschoen/2292963 to your computer and use it in GitHub Desktop.
GeoDjango dependencies on OSX
# The GeoDjango installation page [1] makes the OSX setup seem kind of gnarly. homebrew has
# come a long way and can do a lot of the heavy lifting of building libs needed by GeoDjango.
# When I get some time I'll submit a patch to that page on the Django site with this info...
# [1] https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#macosx
# Freshen homebrew
brew update
brew upgrade
# The main stuff we need
brew install postgresql
brew install postgis
brew install gdal
# Switch to postgis version 1.5.3 - 2.0 not supported yet
# in /usr/local
git checkout -b postgis1.5.3 cb3d49e
brew unlink postgis
brew install postgis
# Create and start a postgresql DB as your non-root user
mkdir -p ~/var/data/postgres
mkdir -p ~/var/log/postgres
touch ~/var/log/postgres/server.log
initdb ~/var/data/postgres
pg_ctl -D ~/var/data/postgres -l ~/var/log/postgres/server.log start
# Create the template_postgis postgres DB template
# Alter the SQL paths as needed for the version of postgresql that you install with brew
createdb -h localhost template_postgis
psql -h localhost -d template_postgis -f /usr/local/share/postgis/postgis.sql
psql -h localhost -d template_postgis -f /usr/local/share/postgis/spatial_ref_sys.sql
# Finally, create the GeoDjango DB with the template_postgis template
createdb -h localhost -T template_postgis geodjango
# Other stuff...
# Get postgres status
pg_ctl -D ~/var/data/postgres status
# Stop your postgres DB
pg_ctl -D ~/var/data/postgres stop -s -m fast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment