Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get my PostgreSQL to work.

It is clearly running, according to: ps aux | grep postgres | grep -v grep

I am getting -

username            5781   0.0  0.0  2441364    524   ??  Ss    9:05AM   0:00.33 postgres: stats collector process       
username            5780   0.0  0.0  2445216   1628   ??  Ss    9:05AM   0:00.19 postgres: autovacuum launcher process       
username            5779   0.0  0.0  2445084    532   ??  Ss    9:05AM   0:00.14 postgres: wal writer process       
username            5778   0.0  0.0  2445084    576   ??  Ss    9:05AM   0:00.14 postgres: writer process       
username            5777   0.0  0.0  2445084    592   ??  Ss    9:05AM   0:00.00 postgres: checkpointer process       
username            5775   0.0  0.1  2445084   3544   ??  S     9:05AM   0:00.12 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
username            6044   0.0  1.6  2884196  66420   ??  S     9:44AM   0:21.62 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -classpath /Applications/ com.intellij.persistence.database.console.RemoteJdbcServer org.postgresql.Driver

But when I try to createuser -s -U $USER, I am getting:

createuser: could not connect to database postgres: 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"?

However, it is clearly running, but just not talking to the correct socket. I tried: sudo find / -name .s.PGSQL.5432 -ls and am getting:

find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
48453370        0 srwxrwxrwx    1 username   wheel    0 Apr 24 11:59 /private/tmp/.s.PGSQL.5432

How do I get PostgreSQL to talk with the correct socket?


I checked ls -la under /var/pgsql_socket/.s.PGSQL.5432:

total 0
drwxrwxrwx   2 _postgres  _postgres   68 Sep  19  2011 .
drwxr-xr-x  28 root       wheel      952 Nov   8  2011 ..
share|improve this question
up vote 2 down vote accepted

Try the following command:

createuser -h -s new_role 

And if you want to connect your db by using psql interface:

psql -h db_name role_name
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.