Skip to content

Instantly share code, notes, and snippets.

@jwhitmarsh
Created February 2, 2017 10:49
Show Gist options
  • Save jwhitmarsh/de5a3f82e274f75239574377752e6256 to your computer and use it in GitHub Desktop.
Save jwhitmarsh/de5a3f82e274f75239574377752e6256 to your computer and use it in GitHub Desktop.
upgrading postgres with homebrew
Assuming you've used home-brew to install and upgrade Postgres, you can perform the following steps.
Stop current Postgres server:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Initialize a new 9.5 database:
initdb /usr/local/var/postgres9.5 -E utf8
run pg_upgrade:
pg_upgrade -v \
-d /usr/local/var/postgres \
-D /usr/local/var/postgres9.5 \
-b /usr/local/Cellar/postgresql/9.4.5_2/bin/ \
-B /usr/local/Cellar/postgresql/9.5.0/bin/
Move new data into place:
cd /usr/local/var
mv postgres postgres9.4
mv postgres9.5 postgres
Restart Postgres:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Check /usr/local/var/postgres/server.log for details and to make sure the new server started properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment