Upgrade Postgres.app on macOS

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:

  1. 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
  2. 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 using kill PID.

  3. Delete the /Applications/Postgres.app directory.

  4. Download and install the latest Universal Postgres.app.

  5. Start that app running, then click the "Initialize" button to initialize the filesystem for the new PostgreSQL 16 database.

  6. 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

Created 2024-06-15T18:26:23-07:00, updated 2024-06-16T10:47:00-07:00 · History · Edit