1

I followed these steps to install PostgreSQL with Homebrew (first time using Homebrew): http://dhilipsiva.blogspot.se/2013/02/install-postgresql-on-os-x-using.html

The last step didn't work. I assume it is supposed to start the server. However, I think I successfully created a database cluster and started the database server following the official documentation (17.2 and 17.3): http://www.postgresql.org/docs/9.2/interactive/runtime.html

My problem is that when I try to create a database using createdb mydb in the terminal, I get the message:

createdb: 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"?

I'm very confused since a lot of the concepts being thrown around here (like sockets, path variables etc) are new to me. I'm also confused about the directory structure in Mac OS X, since I recently migrated from Windows. If anyone could just point me in the right direction it'd be much appreciated.

Update As always, once you post, you find the answer. Well almost: the accepted answer in this post leads me to the conclusion that my Unix domain socket (whatever that is) is located in a place that Postgres doesn't expect.

Can't get Postgres started

Using the -h flag, it works. So the question is, how do I configure Postgres to look for the socket in the right place?

1 Answer 1

0

You are apparently running the default OS X supplied PostgreSQL client, which expects the Unix-domain socket in a different location than the Homebrew version. Basically,

/usr/bin/{createdb,psql,...} ---> /var/pgsql_socket/.s.PGSQL.5432
/usr/local/bin/{createdb,psql,...} ---> /tmp/.s.PGSQL.5432

So make sure your path is set correctly so that you are calling the right one.

Alternatively, you can override the socket location like this:

createdb -h /tmp ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.