Recently I updated Postgres.app and after that I started getting a weird error while running Active Record tests locally using PostgreSQL adapter.

/Users/prathamesh/Projects/sources/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
	Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

This was really weird error as the PostgreSQL server was running smoothly on port 5432 and I was able to run my rails apps without any issues. This issue was only happening while running Active Record tests.

Well, the fix was simple. Just had to reinstall the pg gem and it fixed all issues!