Skip to content

Instantly share code, notes, and snippets.

@Hritik14
Last active February 29, 2024 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hritik14/7b596d03fdae6491648a3d1798a2705a to your computer and use it in GitHub Desktop.
Save Hritik14/7b596d03fdae6491648a3d1798a2705a to your computer and use it in GitHub Desktop.
Upgrade to postgresql@15 from postgresql14 on mac
# stop both postgres (if you have 15 installed already)
brew services stop postgresql@14
brew services stop postgresql@15
brew link postgresql@14 # Important, need to use old links
# You might want to change sub versions mentioned below for 15.* and 14.*
/opt/homebrew/Cellar/postgresql@15/15.4_1/bin/pg_upgrade \
--old-bindir=/opt/homebrew/Cellar/postgresql@14/14.9_1/bin/\
--old-datadir /opt/homebrew/var/postgresql@14 \
--new-bindir=/opt/homebrew/Cellar/postgresql@15/15.4_1/bin/\
--new-datadir /opt/homebrew/var/postgresql@15 \
--check
# If everything went good, finally
/opt/homebrew/Cellar/postgresql@15/15.4_1/bin/pg_upgrade \
--old-bindir=/opt/homebrew/Cellar/postgresql@14/14.9_1/bin/\
--old-datadir /opt/homebrew/var/postgresql@14 \
--new-bindir=/opt/homebrew/Cellar/postgresql@15/15.4_1/bin/\
--new-datadir /opt/homebrew/var/postgresql@15
# and link the new one
brew unlink postgresql@14
brew link postgresql@15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment