A little note on how I setup and bootstrap local PostgreSQL databases on OS X machines.
Instructions below were tested on OS X El Capitan, and target the 9.4.x series of PostgreSQL.
Install and setup PostgreSQL:
1$ brew update2$ brew install postgresql94 ossp-uuid34$ mkdir -p ~/Library/LaunchAgents5$ cp /usr/local/Cellar/postgresql94/9.4.9_1/homebrew.mxcl.postgresql94.plist ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist6$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist78$ rm -rf /usr/local/var/postgres9$ initdb /usr/local/var/postgres -E utf8 --no-locale1011$ sed -i "s/^#port = 5432/port = 5432/" /usr/local/var/postgres/postgresql.conf12$ sed -i "s/^#autovacuum = on/autovacuum = on/" /usr/local/var/postgres/postgresql.conf13$ sed -i "s/timezone = 'Europe\/Paris'/timezone = 'UTC'/" /usr/local/var/postgres/postgresql.conf14$ sed -i "s/log_timezone = 'Europe\/Paris'/log_timezone = 'UTC'/" /usr/local/var/postgres/postgresql.conf1516$ initdb /usr/local/var/postgres1718$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Initialize PostgreSQL:
1$ dropdb test_db23$ createdb -E UTF8 -T template0 test_db45$ psql --command 'CREATE EXTENSION "citext";' --dbname=test_db6$ psql --command 'CREATE EXTENSION "uuid-ossp";' --dbname=test_db78$ tail -F /usr/local/var/postgres/server.log
Load up a dumped database:
1 $ pg_restore --verbose --clean --no-acl --no-owner -h localhost -d test_db ~/dump/2016-10-10-test_db.dump
