Last active
December 23, 2015 12:49
-
-
Save phudgins/6638471 to your computer and use it in GitHub Desktop.
Mac Homebrew upgrade postgres from 9.2.4 to 9.3.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unload the launch_ctl (stop the server) | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
# Move the data directory | |
mv /usr/local/var/postgres /usr/local/var/postgres92 | |
# Upgrade postgresql | |
brew update && brew upgrade postgresql | |
# Init the new database cluster | |
initdb /usr/local/var/postgres -E utf8 | |
# Update the old database cluster to the new one | |
pg_upgrade -b /usr/local/Cellar/postgresql/9.2.4/bin -B /usr/local/Cellar/postgresql/9.3.0/bin -d /usr/local/var/postgres92 -D /usr/local/var/postgres | |
# Load the launch_ctl (start the server) | |
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
# For each ruby, uninstall the pg gem | |
gem uninstall pg | |
# export ARCHFLAGS env var | |
export ARCHFLAGS="-arch x86_64" | |
# For each rails project using pg, reinstall the gem | |
bundle install | |
# Verify it works | |
rails c | |
# Profit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this!