Alright, let's say your computer didn't shutdown properly, and you're running the PostgreSQL service (via homebrew or other mechanism). You may try to restart the server and it may tell you that there was no problem, but you still can't connect.
What's most likely the culprit, is that PostgreSQL still thinks you're running the server via it's Postmaster ID file.
So what you can try is removing that file
And then restarting. That will probably help you out.
For a full detailed description of this process, check out https://coderwall.com/p/zf-fww/postgres-on-osx-with-homebrew-not-running-after-osx-crash