Skip to content

Instantly share code, notes, and snippets.

@tamoyal
Created December 29, 2014 20:02
Show Gist options
  • Save tamoyal/38287887923cc29869e5 to your computer and use it in GitHub Desktop.
Save tamoyal/38287887923cc29869e5 to your computer and use it in GitHub Desktop.
Upgrade Postgres 9.3 to 9.4 on OS X
# Shutdown postgres
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Install 9.4
brew update && brew upgrade postgresql
# Make 9.4 DB
initdb /usr/local/var/postgres9.4 -E utf8
# Upgrade postgis or the upgrade will fail (if you require postgis)
# Same goes with other library dependencies
brew upgrade postgis
# http://www.dixis.com/?p=758
# switch jsonc version if you use postgis (you may want to try the upgrade step below first and only do this if you have to)
brew switch json-c 0.11
# Upgrade data
pg_upgrade \
-d /usr/local/var/postgres \
-D /usr/local/var/postgres9.4 \
-b /usr/local/Cellar/postgresql/9.3.4/bin/ \
-B /usr/local/Cellar/postgresql/9.4.0/bin/ \
-v
# Make sure the 9.3.x bin dir correlates exactly to the previous version of postgres you were running
# Move data
mv /usr/local/var/postgres /usr/local/var/postgres9.3
mv /usr/local/var/postgres9.4 /usr/local/var/postgres
# Start postgres
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment