Note: Based on this tutorial.
There exists a _postgres
account, but I could not switch to it. My solution so far is to create a postgres
account to run the PostgreSQL process.
sudo dscl . -create /Groups/postgres
sudo dscl . -create /Groups/postgres PrimaryGroupID 1000
sudo dscl . -create /Users/postgres
sudo dscl . -create /Users/postgres UserShell /bin/bash
sudo dscl . -create /Users/postgres RealName "PostgreSQL"
sudo dscl . -create /Users/postgres UniqueID "1000"
sudo dscl . -create /Users/postgres PrimaryGroupID 1000
my solution for this is to do:
sudo /usr/bin/dscl . -merge Users/_postgres RecordName postgres
but beware that the postgres user does not survive an OS update.