James Croft

Nuking the Postgres data directory on OSX

Each time I upgrade Postgres via homebrew I seem to end up with an error like:

FATAL: database files are incompatible with server

Homebrew has a command that supposedly migrates between database versions but this didn’t work.

brew postgresql-upgrade-database

I only had development versions of databases stored on my machine, all the important data was stored elsewhere, so instead of migrating the data I deleted the directory and started again from scratch:

rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8