4

I installed Postgres 9.3 from the osX binary.
When I attempted to restart using pg_ctl restart, I received the following error:

$ pg_ctl restart
pg_ctl: could not open PID file "/Library/PostgreSQL/9.3/data/postmaster.pid": Permission denied

Bryan@bryans-mbp Fri Jun 13 13:41:24 ~   
$ sudo ls -la /Library/PostgreSQL/9.3/data/postmaster.pid  
Password:  
-rw-------  1 postgres  daemon  75 Jun 11 10:36 /Library/PostgreSQL/9.3/data/postmaster.pid  

Who should own this file and what should the permissions be?

2 Answers 2

5

The permissions are correct as you want all of the data files and other associated stuff to be owned by the postgres user. I think the issue here is that the postgres daemon is not running as the postgres user.

To check which user the postgres daemon (postmaster) is running as, run:

Most *NIX (Like Solaris):

ps -ef | grep postgres

Linux

ps aux | grep postgres

Make sure that as root, you are running:

sudo -u postgres pg_ctl -D /Library/PostgreSQL/9.3/data start

Adjust the necessary paths for pg_ctl and sudo.

1

You may able to just switch to os-level user to postgres user:

$ sudo su postgres

Then run the restart command:

$ pg_ctl restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .