I'm having trouble creating a successful daemon. Before PostgreSQL went to naming their folders with an @ symbol, I had a working daemon, but now something, somewhere has changed that I can't figure out.
If I run:
sudo -u _systemuser /opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14
PostgreSQL starts fine.
However this plist doesn't work:
Label
homebrew.mxcl.postgresql
RunAtLoad
GroupName
_systemuser
UserName
_systemuser
ProgramArguments
/opt/homebrew/bin/postgres
-D
/opt/homebrew/var/postgres
In LaunchControl, it says "This job has failed for no apparent reason."
So if I enable logging:
Label
homebrew.mxcl.postgresql14
RunAtLoad
GroupName
_systemuser
UserName
_systemuser
ProgramArguments
/opt/homebrew/opt/postgresql@14/bin/postgres
-D
/opt/homebrew/var/postgres@14
StandardErrorPath
/opt/homebrew/var/log/postgresql@14.log
StandardOutPath
/opt/homebrew/var/log/postgresql@14.log
I get the error "User _systemuser cannot write to the file: "file:///opt/homebrew/var/log/postgresql@14.log""
I've changed the permissions to those folders with:
sudo chown -R _systemuser /opt/homebrew/var/postgresql@14
sudo chgrp -R _systemuser /opt/homebrew/var/postgresql@14
However, using this logging plist does evoke a new error in LaunchControl:
2024-12-26 11:06:02.649106 Service could not initialize: posix_spawn(/opt/homebrew/opt/postgresql@14/bin/postgres), error 0xd - Permission denied
But as I said at the start, PostgreSQL starts up fine from CLI.
Stumped. Any ideas on what might be the problem?
Asked by Xoteric
(65 rep)
Dec 26, 2024, 03:27 AM
Last activity: Dec 26, 2024, 08:08 AM
Last activity: Dec 26, 2024, 08:08 AM