I’m trying to make a map for a conference and thought I’d use TileMill. As far as I can tell, the first step (after installing TileMill) is to install postgresql. Here’s where I am with that.

up:~ $ sudo port install postgresql93
up:~ $ sudo port install postgresql93-server
up:~ $ sudo port install postgis2
up:~ $ sudo mkdir -p /opt/local/var/db/postgresql93/defaultdb
up:~ $ sudo chown postgres:postgres /opt/local/var/db/postgresql93/defaultdb
up:~ $ sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb -D /opt/local/var/db/postgresql93/defaultdb'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /opt/local/var/db/postgresql93/defaultdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /opt/local/var/db/postgresql93/defaultdb/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /opt/local/lib/postgresql93/bin/postgres -D /opt/local/var/db/postgresql93/defaultdb
or
    /opt/local/lib/postgresql93/bin/pg_ctl -D /opt/local/var/db/postgresql93/defaultdb -l logfile start

Once I have postgresql and postgis running, I think I’ll be able to download and use street data from OpenStreetMap. At least, that’s my plan. We’ll see how it goes.

Think I got things started with:

up:~ $ su postgres -c '/opt/local/lib/postgresql93/bin/pg_ctl start -D /opt/local/var/db/postgresql93/defaultdb'
Password:
server starting
up:~ $ LOG:  database system was shut down at 2014-01-02 19:53:01 CST
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

Then get it started with:

up:~ $ psql -U postgres
psql93 (9.3.0)
Type "help" for help.

postgres=# create database osm;
CREATE DATABASE
postgres=# \connect osm
You are now connected to database "osm" as user "postgres".
osm=# create extension postgis;
ERROR:  could not open extension control file "/opt/local/share/postgresql93/extension/postgis.control": No such file or directory

Nuts! Need to figure out where I screwed up.

Think the problem is because postgres92 is installed, so uninstall both postgis2 and postgres92. Then reinstall postgis2.

Hmmm. This just reinstalled postgres92, so I guess I should just use postgres92 instead of postgres93.

up:~ $ sudo port install postgresql92-server
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
--->  Computing dependencies for postgresql92-server
--->  Fetching archive for postgresql92-server
--->  Attempting to fetch postgresql92-server-9.2.4_0.darwin_12.x86_64.tbz2 from http://packages.macports.org/postgresql92-server
--->  Attempting to fetch postgresql92-server-9.2.4_0.darwin_12.x86_64.tbz2.rmd160 from http://packages.macports.org/postgresql92-server
--->  Installing postgresql92-server @9.2.4_0
--->  Activating postgresql92-server @9.2.4_0

To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql92/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql92/bin/initdb -D /opt/local/var/db/postgresql92/defaultdb' 
 
To tweak your DBMS, consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf

--->  Cleaning postgresql92-server
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.
up:~ $ sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb
up:~ $ sudo chown postgres:postgres /opt/local/var/db/postgresql92/defaultdb
up:~ $ sudo su postgres -c '/opt/local/lib/postgresql92/bin/initdb -D /opt/local/var/db/postgresql92/defaultdb'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /opt/local/var/db/postgresql92/defaultdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 1600kB
creating configuration files ... ok
creating template1 database in /opt/local/var/db/postgresql92/defaultdb/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /opt/local/lib/postgresql92/bin/postgres -D /opt/local/var/db/postgresql92/defaultdb
or
    /opt/local/lib/postgresql92/bin/pg_ctl -D /opt/local/var/db/postgresql92/defaultdb -l logfile start

Try to start the server:

up:~ $ su postgres -c '/opt/local/lib/postgresql92/bin/pg_ctl start -D /opt/local/var/db/postgresql92/defaultdb'
Password:
server starting
up:~ $ LOG:  database system was shut down at 2014-01-02 20:48:40 CST
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

See if can use it:

up:~ $ psql -U postgres
psql93 (9.3.0, server 9.2.4)
Type "help" for help.

postgres=# create database osm;
CREATE DATABASE
postgres=# \connect osm
psql93 (9.3.0, server 9.2.4)
You are now connected to database "osm" as user "postgres".
osm=# create extension postgis;
CREATE EXTENSION

YES!