Run the usual brew update
, and brew upgrade
to get the latest 9.4 version of PostgreSQL.
After upgrading PG from 9.3 to 9.4 with brew, the server will not start as is. If you value your database contents, and configuration, pg_upgrade
is here to migrate those.
Do not delete the old binaries at once: do not run brew cleanup
, because you need 9.3 binaries to migrate.
By default, your PG should be in /usr/local/var/postgres
, but those files are not compatible with the latest 9.4 release.
With that, the upgrade is simple enough:
$ mv /usr/local/var/postgres /usr/local/var/postgres93
$ initdb -D /usr/local/var/postgres
$ pg_upgrade -b /usr/local/Cellar/postgresql/9.3.5_1/bin -B /usr/local/Cellar/postgresql/9.4.0/bin -d /usr/local/var/postgres93 -D /usr/local/var/postgres
If all goes well, you can start postgres -D ...
, and cleanup the old stuff:
$ rm -fr /usr/local/var/postgres93
$ brew cleanup