Skip to content

Instantly share code, notes, and snippets.

@estebistec
Created January 28, 2012 04:10
Show Gist options
  • Save estebistec/1692545 to your computer and use it in GitHub Desktop.
Save estebistec/1692545 to your computer and use it in GitHub Desktop.
GeoDjango dependencies on OSX
# 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