I've been using Postgres without issue within Rails and have also been running psql without issue. However, I'm running into a problem trying to connect to the database with the pg gem.
The following code:

PG.connectgenerates the error/output:
PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The result is the same whether I specify various dbname: values or not or just let this default.
When I click on the little elephant icon at the top of my screen, it says "Running on port 5432" and, as I said, I can connect with psql without a problem.
I found the very similar cannot connect to Postgres (pg) database from my Ruby Script using gem "pg"(This is not rails, just pure ruby), but the answer simply said Rails works fine.
Any guidance would be appreciated. (Note: I realize I haven't entered any name/password info, but I don't have to enter than when I run psql and I gather it's not getting to the point of authentication).


Check Solution