Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Last active January 27, 2016 12:07
Show Gist options
  • Save crmaxx/cd2c0da27c499a96d01b to your computer and use it in GitHub Desktop.
Save crmaxx/cd2c0da27c499a96d01b to your computer and use it in GitHub Desktop.
pg_upgrade to 9.5.0
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.
Finally, re-install the rails pg gem
gem uninstall pg
gem install pg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment