Homebrew installed PostgreSQL could not connect, database files are incompatible with server
If you don't have any data, then it seems like a problem with Brew. Did you run brew upgrade, there are two answers on StackOverflow that address this, I've merged both of them together to try the best of both worlds.


Backing up

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
sudo mv /usr/local/var/postgres /usr/local/var/.postgres_bak;

Making sure you have the latest version

brew update
brew upgrade postgresql

Either, not both reinitialize or try to upgrade your data-dir


Nuke it (start from scratch, leaving the old back up)

initdb /usr/local/var/postgres -E utf8

Try to upgrade it

pg_upgrade -b /usr/local/Cellar/postgresql/$myOldVersion/bin/ -B /usr/local/Cellar/postgresql/$myNewVersion/bin -d /usr/local/var/.postgres_bak -D /usr/local/var/postgres


Restart server.

brew services start postgresql

Delete the backup, if the server restarts and everything works remove the backup

sudo rm -rf /usr/local/var/.postgres_bak