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
sudo: useradd: command not found

How can a user be added from Terminal?

| improve this question | | | | |

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 /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.

| improve this answer | | | | |

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.

| improve this answer | | | | |

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