add user
Netinfo utility has been removed from Mac OS X 10.5 (Leopard). You must now use the dscl command line utility.
dscl
Mac OS X 10.5 does not have the useradd or adduser commands, since user management is handled by Directory Services. You can instead create a user account with the dscl command from the Terminal application. You will need sudo or root access to create the user account.
Although the manual does not mention groups, it is a good idea to give the user account its own group as well. This prevents any files in the database cluster with group write-access from being modified by other users.
To create the user account and group from the Terminal application, first find an unused group ID and an unused user ID. To see the IDs that are currently in use, type
$ sudo dscl . -list /Groups PrimaryGroupID $ sudo dscl . -list /Users UniqueID
or if it helps you to see just a sorted list of IDs, type
$ sudo dscl . -list /Groups PrimaryGroupID | cut -c 32-34 | sort $ sudo dscl . -list /Users UniqueID | cut -c 20-22 | sort
Assume that group ID 50 and user ID 100 are not in use. First create the group _postgres by typing
$ sudo dscl . -create /Groups/_postgres $ sudo dscl . -create /Groups/_postgres PrimaryGroupID 50 $ sudo dscl . -append /Groups/_postgres RecordName postgres
(Leopard precedes daemon names with an underscore. The last command created an alias without the underscore, though, so that you can forget the underscore exists.)
Then create the user account _postgres by typing
$ sudo dscl . -create /Users/_postgres $ sudo dscl . -create /Users/_postgres UniqueID 100 $ sudo dscl . -create /Users/_postgres PrimaryGroupID 50 $ sudo dscl . -create /Users/_postgres UserShell /bin/bash $ sudo dscl . -create /Users/_postgres RealName "PostgreSQL Server" $ sudo dscl . -create /Users/_postgres NFSHomeDirectory /usr/local/pgsql $ sudo dscl . -append /Users/_postgres RecordName postgres
The user account is now created. It is not given a password intentionally. This prevents anyone but root from logging in as postgres. To use the postgres user account, type
$ sudo su - postgres
When the database cluster is initialised, you want the cluster to not only be owned by the postgres user, but also by the postgres group. Replace the chown line in Section 17.2 with
root# chown postgres:postgres /usr/local/pgsql/data