Skip to content

Instantly share code, notes, and snippets.

@tubbo
Forked from oliverbarnes/install_postgis_osx.sh
Created October 30, 2012 14:02
Show Gist options
  • Select an option

  • Save tubbo/3980337 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/3980337 to your computer and use it in GitHub Desktop.
Installing PostGIS 1.5.3 (old formula) for Postgres 9.1.3 (Mac)
#1. Install postgis 1.5.3. Latest is 2.0.0, so using url old formula on github
brew install https://raw.github.com/mxcl/homebrew/8a04a43763906e6a9bef68881acf997f3a6f6687/Library/Formula/postgis.rb
#2. Create a template to be used on creating GIS-enabled databases
createdb template_postgis
#3. Import Postgis Data
psql -d template_postgis -f /usr/local/Cellar/postgis/1.5.3/share/postgis/postgis.sql
psql -d template_postgis -f /usr/local/Cellar/postgis/1.5.3/share/postgis/spatial_ref_sys.sql
#Test if works
psql -d template_postgis -c "SELECT postgis_full_version();"
#4. Set template permissions to gisgroup
createuser -R -S -L -D -I gisgroup;
psql -d template_postgis
ALTER DATABASE template_postgis OWNER TO gisgroup;
ALTER TABLE geometry_columns OWNER TO gisgroup;
ALTER TABLE spatial_ref_sys OWNER TO gisgroup;
CREATE SCHEMA gis_schema AUTHORIZATION gisgroup;
\q
#4. Adds your app's user
createuser -i -l -S -R -d elocal
psql -d postgres
GRANT gisgroup TO elocal;
\q
#5. Create your app database
createdb -T template_postgis -O elocal elocal_test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment