I am trying to setup pg on a relatively clean lion install and it's not being successful.
First I successfully installed homebrew, and installed postgresql without any errors.
Then I tried to run a rails app, got an error. Tried running this script: http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/
in order to hide the default system postgres install, but now I am getting the following error:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
When I try to run the postgres
script in the bin directory I get the following error:
larson:~ larson$ /usr/local/Cellar/postgresql/9.1.3/bin/postgres ; exit;
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
logout
It's clear that postgres cannot start because it is not configured correctly. Does anybody have any advice on the proper way to configure it so it starts?
Running
brew info postgres
gives you basics to get things going. For example:Or to restart the database server:
Blindly running homebrew scripts with no idea what they're doing doesn't solve problems - it CREATES them. End Rant.
We don't know what the error you had before was, but now you apparently don't have a database cluster configured.
You need to properly set up your Postgres cluster (see the Postgres manual), and/or tell postgres where the database cluster lives when you start it (that's that bit about
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
from the error message). Section 17.3 of the manual talks about this.Per discussion on this Homebrew issue: https://github.com/Homebrew/homebrew/issues/21920
you may just need to do this:
Just check and see that the directory does indeed live there and has the postgres configuration files.
Did you run initdb? I found this issue with a default install of postgres 9.1.3. It looks like initdb builds the database directory with config.
This is included in the instructions that came with the brew install.
Try brew info postgresql and read about 'new install'