Stop your running postgres server (your plist name may or may not have specified the version in it, mine had 94 in the name)
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql94.plist
Upgrade to 9.6
brew update && brew upgrade postgresql
Check your version
postgres --version
If that does not give you 9.6.1 you may need this step (My binaries did not get updated, so I had to force brew to relink them to the 9.6 versions)
brew link --overwrite postgres
Now check your version again
postgres --version
Initialize an empty 9.6 database
initdb /usr/local/var/postgres9.6 -E utf8
Migrate your existing 9.4 data to the new 9.6 database
pg_upgrade -d /usr/local/var/postgres -D /usr/local/var/postgres9.6 -b /usr/local/Cellar/postgresql/9.4.1/bin/ -B /usr/local/Cellar/postgresql/9.6.1/bin/ -v
Replace the default database with the new 9.6 database
mv /usr/local/var/postgres /usr/local/var/postgres9.4
mv /usr/local/var/postgres9.6 /usr/local/var/postgres
You may or may not need to link the new launch plist file
ln -s /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Start up the database
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
brew services start postgresql
It was recommended to recompile the postgres gem
gem uninstall pg
gem install pg
Also optionally run the analyze script provided by postgres
./analyze_new_cluster.sh
Remove these files
rm analyze_new_cluster.sh
rm delete_old_cluster.sh
Nice