If you ran into this after upgrading with homebrew, you may need to follow the instructions here (instead of messing around with the postmaster.pid file): https://collectiveidea.com/blog/archives/2016/01/08/postgresql95-upgrade-with-homebrew Those were written for version 9.5, but they worked perfectly for version 9.6.3 for me today.
If you ran into this after upgrading with homebrew, you may need to follow the instructions here (instead of messing around with the postmaster.pid file): https://collectiveidea.com/blog/archives/2016/01/08/postgresql95-upgrade-with-homebrew
Those were written for version 9.5, but they worked perfectly for version 9.6.3 for me today.