How to create a user or admin user in OSX Apple Mac via terminal commands in 9 simple steps

Adding a user to your system is quite simple via the GUI, however there may be times you wish to mass deploy or run via a script. Below shows the commands on how to do this. Adding a new user to a Mac computer from a Terminal window requires you to define the user’s name, set a password, create the user’s home directory and configure her system permissions.

Please note, that we recommend to always backup or test commands prior mass deployment.

  1. Open a Terminal window. Search in finder TERMINAL and double-click the “Terminal” icon.
  2. Type “sudo dscl . -create /Users/username” and press “Enter.” Replace “username” with a one-word name to identify the user. Replace all instances of “username” in future steps with the same one-word name. Enter your computer’s administrator password and press “Enter” again. The prompt drops to the next line.
  3. Type “sudo dscl . -create /Users/username UserShell /bin/bash” and press “Enter.”
  4. Type “sudo dscl . -create /Users/username RealName “John Smith”” and press “Enter.” Replace “John Smith” with the new user’s full name.
  5. Type “sudo dscl . -create /Users/username UniqueID 1001” and press “Enter.” The number after “UniqueID” must be an ID number that is not assigned to another user.
  6. Type “sudo dscl . -create /Users/username PrimaryGroupID 1000” and press “Enter.”
  7. Type “sudo dscl . -create /Users/username NFSHomeDirectory /Local/Users/username” and press “Enter.” This creates a home folder for the new user.
  8. Type “sudo dscl . -passwd /Users/username password” and press “Enter.” Replace “password” with the desired password that the new user will use when logging in to the computer. You may need to type your computer’s administrator password again to complete this action.
  9. Type “sudo dscl . -append /Groups/admin GroupMembership username” and press “Enter” to give the new user administrative privileges. To make the new account a limited user account, skip this step.

Thank you

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.