Search code examples
macospostgresqlunixpidpgadmin

Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket


I ve installed Postgresql and then ran a bunch of rails apps on my local Mac OSX Mountain Lion and created databases etc. Today after a while when I launched pgAdminIII and tried to launch a database server I got this error:

enter image description here

A quick google showed this post. More browsing pointed to the fact that there might be some sort of postmaster.pid file lying around that might be the root cause of this. If I delete that things would be fine.

However, before I go deleting stuff on my computer I wanted to make sure Im debugging this in a systematic way which would not result in more problems.

Somewhere I read that before deleting that file, I need to run this command:

  ps auxw | grep post

If I get no results then, its OK to delete the file. Else not. Well, I got this result of that command:

  AM               476   0.0  0.0  2423356    184 s000  R+    9:28pm   0:00.00 grep post

So now of course Im throughly confused.

So what should I do?

Here is part of my postgres server error log:

 FATAL:  lock file "postmaster.pid" already exists
 HINT:  Is another postmaster (PID 171) running in data directory "/usr/local/var/postgres"?

Postgresql is still not running, still get the same error and nothing has changed. Im too chicken to delete things without checking on SO.

Could some of you experts please guide a noob.

Thanks


Solution

  • I have the database working now.

    Here are the steps I took:

    1. I rebooted my computer
    2. I opened the terminal and ran cd /
    3. Then I did ls -la
    4. Ensured that I could get to MackintoshHD/usr/local/var/postgres
    5. Then did ls -la
    6. Here I saw the postmaster.pid file
    7. I ran this command cp postmaster.pid ~/Desktop which copied the file to my desktop.I like to do this if I am deleting files. If something does wrong i can put it back
    8. Then I ran this command to remove the file from the postgres directory rm -r postmaster.pid
    9. I went to my pgadmin3 gui and fired it up. and Voila it worked :)

    Thanks to @Craig Ringer for his help