webi-installers icon indicating copy to clipboard operation
webi-installers copied to clipboard

How to use Postgres with serviceman?

Open ryanburnette opened this issue 4 years ago • 1 comments

Can I make postgres a system service in macos with serviceman?

ryanburnette avatar Sep 05 '21 21:09 ryanburnette

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).

coolaj86 avatar Sep 08 '21 23:09 coolaj86