How to add a user from the command line in macOS? [duplicate]

Update: A better explanation of what I answered can be found here. Please use that information instead.

ORIGINAL: macOS doesn't have the same unix commands as Linux. To add a user, properly use the system preferences pane for Users & Groups.

System Preferences will have a Users & Groups section. There you can click the + icon in the bottom left to add a user as standard or administrator.

macOS uses a directory service to administrate users. The adduser command equivalent for Mac is:

dscl . -create /Users/USERNAME_HERE

You may need admin privledges, therefore sudo will be needed like so

sudo dscl . -create /Users/USERNAME_HERE

Followed by a long chain of commands to set up that user properly. Please see the manual page for more detailed information.


A similar tool to useradd is /usr/sbin/sysadminctl on macOS . There isn't a manual but /usr/sbin/sysadminctl -h is explanatory. You should be aware that the command and options will be stored in your shell's history. Note the last line of the help output so that the user password is not stored in your shell's history.