I'm setting up a postgres server and want to create a separate postgres user to run the process, as recommended in the manual. How do I do this? I installed postgres via Homebrew and have experience with Linux but not much with Macs.
Creating User to Run Postgres
administratorpostgresqlserveradmin
Related Question
- MacOS – /System/Library/LaunchDaemons/com.apple.servermgrd.plist Is Missing – Causing postgres to not start properly
- MacOS – run multiple processes on admin user account while logged in to another account on OSX Server (Yosemite)
- Running Postgres as Launch Daemon
- PostgreSQL – Use with launchd Without Issues
- MacOS – homebrew PostgreSQL upgraded to 10.1 but I need 9.6
- MacOS – How to Start Postgres Service in MacOs
Best Answer
Have you checked to see if it is already there? Most postgres installers will create it for you, and so running
grep postgres /etc/passwd
will tell you if it exists. Most system accounts on macs start with_
, so if you do have to create it, you might consider calling it_postgres
, which seems to be common.The question is similar to question 82472, which should provide what you need to create an account from the command line. There are some useful additional caveats in the comment thread and other answers there. Basically, you use the
dscl . create
command to create the user in Apple's Directory Services with all of the properties needed to define the user.