Skip to content

Instantly share code, notes, and snippets.

@eggrollstan
Forked from dimitardanailov/create_user.sh
Created September 6, 2021 17:12
Show Gist options
  • Save eggrollstan/67849c356bf92127e28b387a7cf5630e to your computer and use it in GitHub Desktop.
Save eggrollstan/67849c356bf92127e28b387a7cf5630e to your computer and use it in GitHub Desktop.
Creating a Mac OS X user via shell script
#!/bin/sh
# https://apple.stackexchange.com/questions/82472/what-steps-are-needed-to-create-a-new-user-from-the-command-line/84039#84039
. /etc/rc.common
dscl . create /Users/administrator
dscl . create /Users/administrator RealName "Terminal User Account"
dscl . create /Users/administrator hint "Password Hint"
dscl . create /Users/administrator picture "/Path/To/Picture.png"
dscl . passwd /Users/administrator thisistheaccountpassword
dscl . create /Users/administrator UniqueID 550
dscl . create /Users/administrator PrimaryGroupID 20
dscl . create /Users/administrator UserShell /bin/bash
dscl . create /Users/administrator NFSHomeDirectory /Users/administrator
cp -R /System/Library/User\ Template/English.lproj /Users/administrator
chown -R administrator:staff /Users/administrator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment