title: "Brew Reinstall PostgreSQL"
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.