It is time the year to figure out the answer of:
PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Check if Postgres started:
ps aux | grep postgres
I‘ve collected all possible answers, try any of these combinations. Good luck!
brew services restart postgresql
This file needs to go away:
brew services restart postgresql.
Could be there is no default database:
initdb /usr/local/var/postgres pg_ctl -D /usr/local/var/postgres -l logfile start
If you recently
brew upgrade then maybe you need this:
Restart your computer.