ruk·si

🐘 PostgreSQL
Local Upgrades

Updated at 2017-08-13 13:26

Upgrading PostgreSQL on Mac OS X from 9.5 to 9.6

# Copy data directory to temp location
mv /usr/local/var/postgres /usr/local/var/postgres2

brew uninstall postgresql
brew install postgresql        # so we get new data directory
brew install postgresql@9.5.3  # or w/e was the old version

pg_upgrade \
    -b /usr/local/Cellar/postgresql/9.5.3/bin \
    -B /usr/local/Cellar/postgresql/9.6.3/bin \
    -d /usr/local/var/postgres2 \
    -D /usr/local/var/postgres

brew services start postgresql

# test that it works

rm -rf /usr/local/var/postgres2