2017-12-20-brew-uninstall-postgresql.md 747 B


title: "Brew Reinstall PostgreSQL"

categories: bits

Unfortunately, in order to reinstall a local macOS instance of PostgreSQL from scratch brew uninstall by itself won't be enough. Instead,

check if there's an instance:

$ launchctl list | grep -i sql

Stop it with:

$ brew services stop postgres

Remove PostgreSQL, and all related files:

$ brew uninstall --force postgres
$ rm -rf /usr/local/var/postgres
$ rm -rf .psql_history .psqlrc .psql.local .pgpass .psqlrc.local
$ brew cleanup

Confirm through:

$ brew list | grep sql

Re-install PostgreSQL

$ brew install postgresql

This won't restore the postgres superuser if it's been dropped before.