This Stack Overflow reply was excellent, giving a breakdown of how it was resovled.
Problem
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"?
Running brew services restart postgres
looked like it fixed the issue but when looking at brew services
an error was present in the output.