After upgrading everything in Homebrew, I discovered that my PostgreSQL no longer loaded, due to the database files being an older version than the PostgreSQL software. These are the steps I followed to upgrade all databases, and get up and running again.

1: Make sure PostgreSQL is not running before starting the upgrade process.

2: Make a new PostgreSQL 9.6 database where your old data will be migrated to.

% initdb /usr/local/var/postgres_new -E utf8

3: Upgrade databases to 9.6 by using pg_upgrade tool. To find the version number of the old binaries, you simply ls /usr/local/Cellar/postgresql.

% pg_upgrade \
-b /usr/local/Cellar/postgresql/9.5.4_1/bin/ \
-B /usr/local/Cellar/postgresql/9.6.1/bin/ \
-d /usr/local/var/postgres \
-D /usr/local/var/postgres_new

Change the version numbers needed for your setup, usage of the pg_upgrade tool is as simple as:

pg_upgrade -b oldbindir -B newbindir -d olddatadir -D newdatadir

4: Move your new database to the PostgreSQL default location:

% mv /usr/local/var/postgres /usr/local/var/postgres9.5
% mv /usr/local/var/postgres_new /usr/local/var/postgres

5: That’s it :)