macOS使用命令行创建用户

Gao
## macOS 创建用户 macOS没有一般Unix/Linux的创建用户命令. macOS用户都使用Directory Service实现. ## 使用`dscl` `dscl`: Directory Service command line utility ``` sudo dscl . -create /Users/USERNAME_HERE # or sudo dscl localhost -create /Local/Default/Users/USERNAME_HERE ``` ## 使用`sysadminctl` ``` /usr/sbin/sysadminctl -h sysadminctl -addUser <user name> \ [-fullName <full name>] \ [-UID <user ID>] \ [-GID <group ID>] \ [-shell <path to shell>] \ [-password <user password>] \ [-hint <user hint>] \ [-home <full path to home>] \ [-admin] [-roleAccount] \ [-picture <full path to user image>] \ (interactive] || -adminUser <administrator user name> \ -adminPassword <administrator password>) ```