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 uninstalled and reinstalled postgresql via homebrew. It worked fine until I restarted my computer. Now I'm trying to run my tests and they're blowing up. I'm looking at the current processes and I don't see all those instances of postgres running. I guess I have to turn postgres on. I've tried running

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

but that doesn't seem to do anything (although it does say server starting, which is false)

How do I get the server started?

Update. Log info:

cat /usr/local/var/postgres/server.log 
postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory

Thanks

share|improve this question
    
Look at the logs. What do they say? Not just /usr/local/var/postgres/server.log but also the logs in /usr/local/var/postgres/pg_log/. –  Craig Ringer Feb 20 '13 at 1:49
    
posted the server.log. there is no /usr/local/var/postgres/pg_log directory –  AdamT Feb 20 '13 at 2:18

2 Answers 2

Make sure /usr/var/local/postgres/postmaster.pid does not exist before starting the server.

On a crash instead of a regular shutdown, this file will remain on disk. It acts as a global lock.

share|improve this answer

It looks like you haven't initdb'd a database in /usr/local/var/postgres/, so there's no postgresql.conf or pg_hba.conf there. Is it just an empty directory? Or might there be a subdirectory with your DB in it?

If it's empty, then you either have the wrong location for your Pg datadir or you've removed it as part of some prior uninstall and need to create a new DB with the initdb command.

share|improve this answer
    
after installing postgres with homebrew it tells me to If this is your first install, create a database with: initdb /usr/local/var/postgres -E utf8 when I run this it tells me that the folder already contains postgres so I rm -rf what's in there and just run it again. this is then followed by a bunch of confirmation oks. i think my issue might be related to this: github.com/mxcl/homebrew/issues/14527 –  AdamT Feb 20 '13 at 3:34
    
@NewB no, I strongly doubt that it is related. Your problem is that your data directory is empty or missing. If you do ls -al /usr/local/var/postgres what is listed? –  Craig Ringer Feb 20 '13 at 4:14
    
once i updated the kernel, as is suggested in issue14527, and then restarted i was able to start postgres. i'm still afraid to reboot even though i did update the sysctl.conf. all seems to be working so far. will update this if it's another epic fail. –  AdamT Feb 20 '13 at 13:51

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.