Postgresql installation issues on OS X
I used Fink to install postgresql on os x. when i try to start psql, i get:
psql: 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"?
I have never installed postgresql before so I am not really sure where to look. Have any suggestions?
Solution 1:
That means the PostgreSQL daemon is not running. You'll want to find where the daemon is installed. By default, it should be installed in /usr/local/pgsql. If it's there, inspect to see if there is a /usr/local/pgsql/data directory. If there is not run the following:
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
then, if successful, run
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data start
And that should get you on the right track.
Solution 2:
It seems to me, you're trying to run PostgresSQL under your current user-account. I don't know the fink-properties for PostgreSQL, but the associated daemons are supposed to run under a dedicated user-account (lets say postgres for example).
First identify the data-directory, in which PostgresSQL stores it's data and configuration files exist. Your error messages seems to say this may be "/Library/PostgreSQL/8.4/data". This directory should belong already to the postgres-user and have rwx-privileges for him. I guess Fink has already created it, so check out the install-logs.
Look inside this directory (you may need to su/sudo because you may not have sufficient privileges to do so with your console user). If there are some files, eg. postgresql.conf, a bunch of pg_* and some other files, all belonging to postgres, the data directory seems to be allright, otherwise invoke the following (replace the binary-path, postgres-user and the data path with your system-values, see man initdb for more options):
sudo -u postgres /usr/local/pgsql/bin/initdb -D /Library/PostgreSQL/8.4/data
It's important to sudo as the postgres user here, because the user-account the postgres deamons runs as will have to have the sufficients access-rights.
Also, you will have to start the deamon with the the sudo (this should later be handled by a lauchctl-entry, or something similar), so:
sudo -u postgres /usr/local/pgsql/bin/pg_ctl -D /Library/PostgreSQL/8.4/data
You can always re-create the data-directory, but be sure to make a backup and do not overwrite it when postgres is still running.
Solution 3:
You can check that Postgresql is running and listening with:
lsof -i |grep LISTEN