Single user mode
Booting into single user mode will allow you to run terminal commands with full access to the file system. After running your commands simply type in reboot.
NOTE: before having write access you will need mount the root volume as read/write
- mount -uw /
Create a new user in Single User Mode (This creates a new Administrator Account)
You can create a new administrator account by restarting the Setup Assistant:
- Boot into Single User Mode: Start/restart your Mac. As soon as you hear the startup tone, press and hold ⌘ + S until you see a black screen with white lettering. (If you end up back on the login screen after a flash of the black screen with white lettering, enter your password and it will return to the black screen.)
- Mount the drive by typing
/sbin/mount -uw /
then ↩ enter. - Remove the Apple Setup Done file by typing
rm /var/db/.AppleSetupDone
then ↩ enter. - Reboot by typing
reboot
then ↩ enter. - Complete the setup process, creating a new admin account.
With macOS Catalina, the APFS volume scheme is a little different. Change step 2 to /sbin/mount -uw /System/Volumes/Data
. Continue to step 3.
Creating a new user with macOS Catalina, Big Sur and Monterey using Terminal in recovery mode.
It appears that with Big Sur, you loose Admin privileges in single user mode. So in order to delete the Apple Setup Done file, we now have to boot into Recovery mode first and use Terminal to carry out our command. Very similar to the above method of removing the file .AppleSetupDone, we need to locate the db folder in the Macintosh HD Data partition. With macOS Big Sur and Monterey, the db folder has now been relocated in an additional "private" folder.
- First, Boot into Recovery Mode with CMD+R
- Access Disk Utility and mount the Data volume. Should be called Macintosh HD - Data
- Close Disk Utility and open Terminal.
- From terminal enter this the new command.
rm /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone
then enter. - Reboot by typing
reboot
then enter - Complete the setup process, creating a new admin account.
More information on this method can be found here. https://discussions.apple.com/docs/DOC-250002676
Delete test account in Single User Mode (This removes any test acct and creates a new Admin acct)
- ⌘+S
/sbin/mount -uw /
cd /var/db/dslocal/nodes/Default/users/
rm test.plist
rm -rf /Users/test
rm /var/db/.AppleSetupDone
reboot
With macOS Catalina, the APFS volume scheme is a little different. Change step 2 to /sbin/mount -uw /System/Volumes/Data
. Continue to step 3.