Created
January 13, 2016 20:10
-
-
Save codesnik/bfff3ee4f32d2faebad3 to your computer and use it in GitHub Desktop.
stupid but working updating postgresql to 9.5.0 with homebrew on OSX
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
# stupid but working updating postgresql to 9.5.0 with homebrew on OSX | |
brew update | |
# if you already updated and have your old databases inacessible, just do | |
# ls /usr/local/Cellar/postgresql | |
# for versions, then | |
# brew switch postgresql 9.4.5 | |
# or whatever version you had before | |
# create giant backup for all your databases: | |
pg_dumpall > tempdump.sql | |
# ...5 minutes later... | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
# I suggest you to check your postgres db is shut down | |
ps axu | grep postgres | |
brew upgrade postgresql | |
# ...5 minutes... | |
# save your older database | |
mv /usr/local/var/postgres /usr/local/var/postgres.old | |
# create empty database | |
mkdir /usr/local/var/postgres | |
chown ${USER}:admin /usr/local/var/postgres | |
initdb -D /usr/local/var/postgres | |
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
# check if postgres started ok | |
# psql postgres | |
# check logs if not started: | |
# tail /usr/local/var/postgres/server.log | |
time psql < tempdump.sql | |
# ...it could take a lot of time. 1.5hours in my case... | |
# check everything's working... then: | |
# rm -rf /usr/local/var/postgres.old | |
# rm temdump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment