So you upgraded postgres

So.. you upgraded Postgres (by accident) and are now getting a FATAL: database files are incompatible with server and The data directory was initialized by PostgreSQL version X, which is not compatible with this version Y.Z.. This post shows the quick fix.

So you’re on MacOS. Suddenly Postgres won’t start. A tail /usr/local/var/log/postgres.log or tail /usr/local/var/postgres/server.log (Postgres < 9.6) give you the above error.

Let’s say you installed v11.2 but previously had v10. Do the following:

brew postgresql-upgrade-database

Googling this gives more (old) complicated solutions like this github comment but this worked for me..