Postgres.app keeps a data folder per major version: the old ones after every upgrade
Each PostgreSQL major version in Postgres.app gets its own data directory, and upgrading leaves the old one behind. How to check, and remove it safely.
Postgres.app stores each PostgreSQL major version's data separately, in ~/Library/Application Support/Postgres/var-XX, where XX is the version. Upgrading means creating a new server for the new version and moving data across, and the Postgres.app documentation suggests removing the old data once you have checked the upgrade. Many people never do.
Measure it
du -sh ~/Library/Application\ Support/Postgres/var-* 2>/dev/nullIf you see several, open Postgres.app and check which server is running and which data directory it uses (shown in the server settings).
Before removing an old one
- Confirm the current server has your databases:
psql -llists them. - If you are unsure whether the old folder holds anything you still need, dump it first with the old version's
pg_dumpallwhile that server is running. - Remove the old server from Postgres.app's server list, so it does not try to start it.
- Move the old
var-XXfolder to the Trash. Empty it once everything works.
Inside a data directory you keep
The largest growth is usually the databases themselves, followed by write-ahead log files if replication or archiving settings hold them. Dropping test databases you no longer use is the quickest saving:
psql -c "SELECT datname, pg_size_pretty(pg_database_size(datname)) FROM pg_database ORDER BY pg_database_size(datname) DESC;"Homebrew, Docker and other database installs keep their data elsewhere. Our guide to local database data directories covers each.
Common questions
Where does Postgres.app store data?
In ~/Library/Application Support/Postgres/var-XX, with one folder per PostgreSQL major version, where XX is the version number.
Can I delete old var folders from Postgres.app?
Yes, once the current server has your data. Check with psql -l, remove the old server from Postgres.app's list, then move the old folder to the Trash.
How do I see which Postgres databases are largest?
Run a query on pg_database with pg_database_size, as shown in this guide, to list each database with its size.