Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hale/2885672 to your computer and use it in GitHub Desktop.
Save hale/2885672 to your computer and use it in GitHub Desktop.
Complete instructions for how to get Code For America's OpenBlight Dashboard working on Mac OS X 10.6 Snow Leopard

Installation of OpenBlight Dashboard on Mac OS X 10.6 Snow Leopard

The install process is rather complicated, so I would recommend scanning through this page first and making sure you understand what's going on.

1) Grab the files.

git clone git://github.com/codeforamerica/openblight.git

2) Install PostgreSQL and PostGIS.

brew update
brew install postgres postgis

Follow the post-installation instructions for postgres. If you missed them, run brew info postgres. Finally, create a default postgres user:

createuser -sdl postgres

3) Configure PostGIS and set up the database

Now we have to create the databases and add the PostGIS extension to them.

First create a template database with support for raster + topology:

createdb template_postgis -U postgres
psql -U postgres -d template_postgis -f /usr/local/share/postgis/postgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/rtpostgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/topology.sql

Next create the databases:

1) Ensure the local postgres access has uninhibited access to the database. (For more information see the documentation).

sudo gedit /usr/local/var/postgres/pg_hba.conf

Check for the presence of this line

local   all         all                                      trust

Save the file and reload the server:

pg_ctl -D /usr/local/var/postgres restart

2) Open an interactive terminal and create the two databases:

Check results with \l.

psql -U postgres -d template1
CREATE DATABASE openblight_test;
CREATE DATABASE openblight_dev;

Now we can spatially enable them:

psql -u postgres -D openblight_dev
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
\q
psql -u postgres -D openblight_test
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

4) Final steps

Install the required gems

bundle install

Load the database schema

rake db:schema:load

Prepare the test database

rake db:test:prepare

By now everything should be set up. Check it's all working by running the test suite:

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