webi-installers
webi-installers copied to clipboard
How to use Postgres with serviceman?
Can I make postgres a system service in macos with serviceman?
Yes.
# Mac (Login / Launch Agent)
sudo env PATH="$PATH" \
serviceman add --name postgres --path "${PATH}" --user -- \
postgres -D "$HOME/.local/share/postgres/var" -p 5432
# Linux (or System Boot / Launch Daemon on Mac)
sudo env PATH="$PATH" \
serviceman add --name postgres --path "${PATH}" \
--system --username "$(id -u -n)" --force -- \
postgres -D "$HOME/.local/share/postgres/var" -p 5432 \
--unix-socket-directories="$HOME/.local/share/postgres/var/run/"
The --force is necessary because serviceman gets confused thinking that --foo=/bar describes a file (it expects --foo /bar, but that should be fixed).