Skip to content

How to uninstall PostgreSQL on a Mac, when you have more than one version

Stop each server, uninstall each version, and find the data folder each one keeps. On our Mac: two versions, two data folders, and a launch agent left behind.

5 min read

How do I uninstall PostgreSQL installed with Homebrew?

List what you have, then stop and remove each version:

brew list | grep postgresql
brew services stop postgresql@15
brew uninstall postgresql@15

On our Mac the list showed two: postgresql@15 (15.14) and postgresql@16 (16.13). Repeat for each one you want gone.

Where is PostgreSQL's data on a Mac?

Each version keeps its own: /opt/homebrew/var/postgresql@15 (76 MB here) and /opt/homebrew/var/postgresql@16 (39 MB). Uninstalling leaves them in place. Back up first with pg_dumpall > ~/Desktop/pg-backup.sql while the server runs, then move the folder to the Trash.

Why does PostgreSQL still start after uninstalling?

A launch agent may be left over. Ours had ~/Library/LaunchAgents/homebrew.mxcl.postgresql@15.plist, though brew services showed version 15 as not running. Run brew services stop before uninstalling, which removes it, or move the file to the Trash and log out and back in.

What about Postgres.app or the EnterpriseDB installer?

  • Postgres.app: quit it, move it to the Trash, and check ~/Library/Application Support/Postgres for its data. See Postgres.app's old data folders.
  • EnterpriseDB installer: run uninstall-postgresql from /Library/PostgreSQL/<version>/, then remove that folder.

How much each database's data takes, before you decide: database data folders.

The same pattern with MySQL: uninstall MySQL.

Common questions

How do I completely remove PostgreSQL from my Mac?

For each version, run brew services stop and brew uninstall, then remove its data folder in /opt/homebrew/var once you have a backup.

Does uninstalling PostgreSQL delete the databases?

No. Each version's data folder stays in /opt/homebrew/var until you remove it.

Read next