These instructions apply to modern macOS and OS X systems.
It also doesn’t contain any data beyond what macOS adds when the account is created.
This method of gaining access to a Mac has a couple of drawbacks.

Lifewire / Theresa Chiechi
If you’re not able to shut it down normally, press and hold thePowerbutton.
Once the Mac shuts down, restart it in a special startup environment called Single User mode.
This mode boots the Mac into a Terminal-like interface where you might run commands from a prompt.

To boot to Single User mode, press and holdCommand+Rwhile you start the Mac.
The Mac displays scrolling lines of text as it boots up.
Mount the startup drive to enter the files located on it.
At the command prompt, enter/sbin/mount -uw /and then pressEnterorReturnon the keyboard.
With the startup drive mounted, you could access its files and folders from the command prompt.
This process doesn’t remove or alter your existing system or user data.
It allows you to create one new admin user account.
At the command prompt, enterrm /var/db/.applesetupdoneand then pressEnterorReturn.
At the prompt, enterrebootand then pressEnterorReturn.