I've been using Postgres.app to run PostgreSQL on my Mac for years. I like that it's easy to install, gives me a task tray icon to control it and means I don't have to run a full Docker environment just to hack on projects like my blog.
I want to try out the PostgreSQL vector extension, since it's now supported by Heroku PostgreSQL. Postgres.app added support for that extension last year, but I need to upgrade my installation to get it.
This also meant migrating from PostgreSQL 15 to PostgreSQL 16. I didn't want to lose my existing data (even though it's just for development environments), so I dug around and found their documentation on migrating.
Here's what I did:
-
Dump all of my development databases using
pg_dumpall
. This wasn't on my$PATH
so I ran it like this:/Applications/Postgres.app/Contents/Versions/15/bin/pg_dumpall > ~/tmp/all-databases.sql
-
Stop the Postgres.app server. I quit it from the task tray icon but to my surprise this didn't seem to stop the server itself, so I ran
ps aux | grep postgres
and killed the main process manually usingkill PID
. -
Delete the
/Applications/Postgres.app
directory. -
Download and install the latest Universal Postgres.app.
-
Start that app running, then click the "Initialize" button to initialize the filesystem for the new PostgreSQL 16 database.
-
Restore all of my databases using the
psql
command line tool like this:cat /tmp/all.sql | /Applications/Postgres.app/Contents/Versions/16/bin/psql