How can I create a new user using Mac Terminal in Recovery Mode?

When encountering issues with my Mac, I sometimes need to create a new user account to troubleshoot or maintain system integrity. Recently, I learned that it is possible to perform this task even when the macOS is in Recovery Mode. I understand that this involves using the Terminal, which is accessible in Recovery Mode. However, I am unsure of the exact steps required to achieve this process. What are the specific commands and procedures I should follow to successfully create a new user account while my Mac is in Recovery Mode, using the Terminal? I want to ensure that I execute the procedure correctly to avoid causing any further issues with my system.
4 Answers

Creating a user in Mac Terminal Recovery Mode is a straightforward task, but it requires precision. First, restart your Mac and hold Command (⌘) + R to boot into Recovery Mode. Once there, open Terminal from the Utilities menu. You will need to navigate correctly to the appropriate directory with the cd
command.
In Terminal, you will create the user through several dscl
commands. Remember to replace ‘newuser’ and ‘yourpassword’ with your own chosen username and password:
- Execute the following:
bash
dscl . -create /Users/newuser
dscl . -create /Users/newuser UserShell /bin/zsh
dscl . -create /Users/newuser RealName 'New User'
dscl . -create /Users/newuser UniqueID '502'
dscl . -create /Users/newuser PrimaryGroupID 80
dscl . -create /Users/newuser NFSHomeDirectory /Users/newuser - Set a password:
bash
dscl . -passwd /Users/newuser yourpassword - Grant admin rights:
bash
dseditgroup -o edit -a newuser -t user admin
Restart your computer to apply the changes, and your new user should be ready to use.

Here’s a step-wise process to add a new user when you are operating in macOS Recovery Mode using Terminal. Carefully follow these instructions:
- Reboot your Mac and hold the Command (⌘) + R keys until the Apple logo appears to enter Recovery Mode.
- From the menu bar, select ‘Utilities’ and then ‘Terminal.’
- Type this command to navigate:
bash
cd /Volumes/Macintosh\ HD/var/db/dslocal/nodes/Default - To create a new user, execute the following commands one by one:
bash
dscl . -create /Users/techuser
dscl . -create /Users/techuser UserShell /bin/bash
dscl . -create /Users/techuser RealName 'Technical User'
dscl . -create /Users/techuser UniqueID '503'
dscl . -create /Users/techuser PrimaryGroupID 1000
dscl . -create /Users/techuser NFSHomeDirectory /Users/techuser - To securely set a password:
bash
dscl . -passwd /Users/techuser newpassword - Add the new user to the admin group:
bash
dscl . -append /Groups/admin GroupMembership techuser - After entering the above commands, reboot your Mac as usual.
The new account should appear on the login screen, reflecting an admin status.

From my experience, creating a user via Terminal in Recovery Mode on a Mac generally involves the following methodical approach:
- Initiate Recovery Mode by rebooting your Mac and holding Command (⌘) + R keys.
- When you’ve entered Recovery Mode, open Terminal through the Utilities menu.
- Change the directory to the appropriate path with:
bash
cd /Volumes/Macintosh\ HD/var/db/dslocal/nodes/Default - Implement the user creation commands, substituting ‘newuser’ with your desired username:
bash
dscl . -create /Users/newuser
dscl . -create /Users/newuser UserShell /bin/zsh
dscl . -create /Users/newuser RealName 'New User'
dscl . -create /Users/newuser UniqueID '1002'
dscl . -create /Users/newuser PrimaryGroupID 20
dscl . -create /Users/newuser NFSHomeDirectory /Users/newuser
dscl . -passwd /Users/newuser mypassword
dseditgroup -o edit -a newuser -t user admin
Ensure each command runs successfully, then close Terminal and continue with a normal reboot. The new user account, which has administrative privileges, should be present at the login screen.

To create a new user account while in Mac Terminal in Recovery Mode, follow these steps:
- Restart your Mac and hold down Command (⌘) + R keys to enter Recovery Mode.
- Once in Recovery Mode, select ‘Utilities’ from the menu bar, then choose ‘Terminal.’
- In the Terminal window, type the following command and press Enter to access the directory where the user data is stored:
bash
cd /Volumes/Macintosh\ HD/var/db/dslocal/nodes/Default/users - Use the
dscl
command to create a new user. Replace ‘newuser’ with the desired username:
bash
dscl . -create /Users/newuser
dscl . -create /Users/newuser UserShell /bin/bash
dscl . -create /Users/newuser RealName 'New User'
dscl . -create /Users/newuser UniqueID '1001'
dscl . -create /Users/newuser PrimaryGroupID 20
dscl . -create /Users/newuser NFSHomeDirectory /Users/newuser - Set the password for the new user:
bash
dscl . -passwd /Users/newuser yourpassword - Add the new user to the admin group:
bash
dscl . -append /Groups/admin GroupMembership newuser - Exit Terminal and restart your Mac normally to complete the process.
That’s it! Your new user account should be available when you log back in.