I have this instructions on CentOS 7 Linux version.

$ sudo groupadd oinstall
$ sudo groupadd dba
$ sudo groupadd oper

$ sudo useradd -G dba,oper -g oinstall oracle
$ sudo passwd oracle

And Already I know that it is possible to add group and user using:

$ sudo dscl . -create /Groups/nameGroup

$ sudo dscl . -create /Groups/nameGroup PrimaryGroupID xNumberGroup
$ sudo dscl . -create /Groups/nameGroup RealName "nameGroup Daemon Group"
$ sudo dscl . -create /Groups/nameGroup passwd "*"

$ sudo dscl . -create /Users/nameUser UniqueID xNumberUser
$ sudo dscl . -create /Users/nameUser PrimaryGroupID xNumberGroup
$ sudo dscl . -create /Users/nameUser UserShell /usr/bin/false
$ sudo dscl . -create /Users/nameUser RealName "nameUser Daemon User"
$ sudo dscl . -create /Users/nameUser passwd "*"
$ sudo dscl . -create /Users/nameUser NFSHomeDirectory: /usr/local/Some/Folder

$ sudo dscl .  append Groups/nameGroup GroupMembership nameUser

The question is how to perform Linux steps on macOS in the simplest and sure manner?

When I say the above I want to imply, what lines can I do without?

PD: I know is it possible install Oracle Database using Virtual Machine but I'm not interested (I'm exploring this way).


The easiest way to add a group account on macOS is to use System Preferences/Accounts, click the + button and select the type of account to Group

create group in system preferences

However, if you are looking for a simple way to add a group account in command line then other than the dscl option there is also the Directory Service command line tools. Type following in Terminal:

dseditgroup -o create -u myadminuser -P myadminpassword -r "Some Group" somegroup

That will create the group account in the /Local/Default domain (same as the above in GUI).

You can add an existing user to the newly added group with:

dseditgroup -o edit -u myadminuser -P myadminpassword -t user -a someuser somegroup

and check membership in the group with:

dseditgroup -o checkmember -m someuser somegroup

It will display either:

yes someuser is a member of somegroup


no someuser is NOT a member of somegroup
|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .