PostgreSQL error 'Could not connect to server: No such file or directory' PostgreSQL error 'Could not connect to server: No such file or directory' postgresql postgresql

PostgreSQL error 'Could not connect to server: No such file or directory'


Check there is no postmaster.pid in your postgres directory, probably /usr/local/var/postgres/

remove this and start server.

Check - https://github.com/mperham/lunchy is a great wrapper for launchctl.


For me, this works

rm /usr/local/var/postgres/postmaster.pid


"Postgres.app" is a better fix if you are on OS X


Here is the fix:

  1. Stop the database
  2. cd /var
  3. sudo rm -r pgsql_socket
  4. sudo ln -s /tmp pgsql_socket
  5. chown _postgres:_postgres pgsql_socket
  6. Restart PostgreSQL (not your computer)

More information is available at "postgresql 9.0.3. on Lion Dev Preview 1".