Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I run postgres 9.1 / ruby 1.9.2 / rails 3.1.0 on a maxbook air for local dev. It's all been running smoothly for months, (though this is the first time I've done development on a mac.)

It's a macbook air from last year, and today I got the mac osx software update message as I have a few times before, and my system downloaded approx 450mb of updates and restarted. It now says it's on OSX 10.7.3.

Point is, postgres has stopped working, when I start my thin server (mirror heroku cedar) as normal, and then browse to my rails app I get:

PG::Error

could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

What happened? After browsing around a few questions I'm still confused, but here's some extra info:

  • Running psql from command line gives same error
  • I can run pgadmin 3 and connect via it and run SQL no problems
  • Running which psql shows the version as /usr/bin/psql
  • I created a PostgreSQL user back when I got the mac (it's always been on lion) I've no idea why, almost certainly I was following a tutorial which I neglected to store in my notes. Point is I am aware there is a _postgres user as well. I know it's rubbish, but apart from a note on passwords, I don't have any extra info on how I configured postgres - though the obvious implication is that I did not use the _postgres user.

Anyone have suggestions or information on what might have changed / what I can try to debug and fix? Thanks.

Edit: Playing around based on this question and answer: http://stackoverflow.com/questions/7975414/check-status-of-postgresql-server-mac-os-x, see this string of commands:

$ sudo su postgreSQL
bash-3.2$ /Library/PostgreSQL/9.1/bin/pg_ctl start -D /Library/PostgreSQL/9.1/data
pg_ctl: another server might be running; trying to start server anyway
server starting
bash-3.2$ 2012-04-08 19:03:39 GMT FATAL:  lock file "postmaster.pid" already exists
2012-04-08 19:03:39 GMT HINT:  Is another postmaster (PID 68) running in data directory "/Library/PostgreSQL/9.1/data"?

bash-3.2$ exit
share|improve this question

migrated from serverfault.com Apr 9 '12 at 11:26

This question came from our site for professional system and network administrators.

    
Hello @user52224 did you find an answer to this question? Have you checked the pid file to see what process id it contains and if so whether that process does exist? –  Paul Aug 11 '12 at 13:56

1 Answer 1

If machine gets turned off without going through the actual shutdown process, then PostgreSQL will refuse to start during the next boot up. This is because the PID file from before is still there and PostgreSQL thinks it is already running. That is what the error message in your edit is telling you.

What you need to is remove the postmaster.pid file from the PostgreSQL directory. According the your error message, the full path to the PID file is: /Library/PostgreSQL/9.1/data/postmaster.pid. Remove that file and PostgreSQL will start up no problem.

share|improve this answer

Your Answer

 
discard

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.