Upgrading PostgreSQL on macOS- 1 min
While working on building a spatial database system I needed to update PostgreSQL from 9.5.3 to 9.6.1 in order to use the most recent version of PostGIS. I installed postgres with homebrew.
I first updated homebrew, then upgraded postgres.
Then I turned off the old version (9.5.3) with homebrew. Without doing this you’ll be unable to update.
Next I started the new version of postgres.
Finally, I attempted to migrate the data from 9.5.3 to 9.6.1.
This didn’t work. The error was due to the
postmaster.pid file in
/usr/local/var/postgres. If this happens rename the file and rerun the above command.
Now move the postgres files to the the original location. That way we don’t have to change where postgres looks for the data.
PostgreSQL 9.6.1 is up and running and ready to go.