Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Forked from juniorz/install_postgis_osx.sh
Created April 20, 2012 14:45
Show Gist options
  • Save oliverbarnes/2429181 to your computer and use it in GitHub Desktop.
Save oliverbarnes/2429181 to your computer and use it in GitHub Desktop.
Installing PostGIS 1.5.3 (old formula) for Postgres 9.1.3 (Mac)
#If you don't have Postgres installed yet:
# https://github.com/tsaleh/tammer-saleh/blob/master/views/posts/installing-postgresql-for-rails-3-1-on-lion.html.textil
#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 <app_user>
psql -d postgres
GRANT gisgroup TO <app_user>;
\q
#5. Create your app database
createdb -T template_postgis -O <app_user> <app_db>;
@oskamaya
Copy link

thanks for the old formula.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment