Upgrade Postgres 9.4 to 9.6 in MAC.

Postgres 9.6.1 is the current Postgres version, if you want to upgrade the Postgres version in mac it very easy now using homebrew.

Just follow the below steps
Step 1: Turn PostgreSQL off first:
    $ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    # or, if you're running a current version of Homebrew
    $ brew services stop postgresql

Step 2: Update brew and upgrade Postgres
    $ brew update && brew upgrade postgresql

Step 3: Initialize the new empty database
   $ initdb /usr/local/var/postgres9.6.1 -E utf8

Step 4: When we update check the currently available version of the system
    $ ls /usr/local/Cellar/postgresql/
Which gives you output something like this: 9.4, 9.5.0, 9.6.1 If you have more than two, that’s ok, just get the most recent one (9.6.1) and the last before 9.5.0. Remember that version for the next step.

Step 5: Upgrade the version
$ pg_upgrade \
  -d /usr/local/var/postgres \
  -D /usr/local/var/postgres9.6.1 \
  -b /usr/local/Cellar/postgresql/9.5.0/bin/ \
  -B /usr/local/Cellar/postgresql/9.6.1/bin/ \
  -v

Step 6: Next, move the new directory to where postgres expects it to be.
     $ mv /usr/local/var/postgres /usr/local/var/postgres-9.5.0
     $ mv /usr/local/var/postgres9.6.1 /usr/local/var/postgres

Step 7: Run the postgres once again
    $ brew services start postgresql

That's it our upgradations process is completed now.
REF LINKS:  link_1link_2

Comments

Post a Comment

Popular posts from this blog

Debug Nodejs inside docker container

Swap primary keys between two records in the same table in Postgres

How to add a bootstrap table with fixed header and scrollable body