9

This question already has an answer here:

In Terminal, I used, useradd liao2, as I would also do in Linux, but it failed:

useradd liao2
-bash useradd: command not found

I also tried using sudo:

sudo useradd liao2
Password:
sudo: useradd: command not found

How can a user be added from Terminal?

marked as duplicate by Mike Scott, fsb, Monomeeth, klanomath, Allan Jun 14 '17 at 22:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

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 /User/USERNAME_HERE

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

sudo dscl . -create /User/USERNAME_HERE

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

11

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.

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