In January PostgreSQL 9.5 was released but sometimes update problems arise much later. Especially when you already forgot something had been upgraded. In this case it was my upgrade of homebrew PostgreSQL from version 9.4 to 9.5. Since released a couple weeks back already, many of you probably fixed their or similar problems but this blog shall serve as a reminder as well. So once I tried to start postgres lately …

hostname:dir user$ brew services start postgresql
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

… everything seemed normal but the following was thrown into system.log:

timestamp[1]: (homebrew.mxcl.postgresql[34297]) Service exited with abnormal code: 1
timestamp[1]: (homebrew.mxcl.postgresql) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

Not very enlightening so one had to check /usr/local/var/postgres/server.log to uncover the reason

FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.4, which is not compatible with this version 9.5.4.

pgadmin4Now there are two alternatives. One you just remove your old database and initiate a new one with rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8 or two utilize pg_upgrade. Start Postgres again with hostname:dir user$ b
rew services start postgresql
(eventually update your pgAdmin to version 4 (nice new GUI)) and you have a working Postgres setup again.