This is the method in Linux:
groupadd -g 5000 vmail useradd -g vmail -u 5000 vmail -d /var/mail
How is it done in OS X?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Found the answer that works from in a 4 year old post on this board. This creates the user, and the group, with the specific gid.
dscl . -create /Users/vmail UniqueID 5000 PrimaryGroupID 5000 RealName "vmail"
It can be checked, because it runs silently, with the following. The command in my case gives the following output.
bash-3.2# dscl . -read /Users/vmail UniqueID UniqueID: 5000 PrimaryGroupID 5000 RealName vmail bash-3.2#
Ok, for some reason it doesn't actually add a the group - so you have to go into the GUI, System->preferences->Users/Groups and add the group, and set it's UID at the top, to 5000 - then it all works