If you lost your administrator rights on macOS 10.13 High Sierra, macOS 10.12, Mac OS X 10.10 Yosemite or Mac OS X 10.11 El Capitan, you can recover the admin privileges easily by rebooting into Apple’s Setup Assistant tool. This will run before any accounts have been loaded, and will run in “root” mode, allowing you to create accounts on your Mac. Then, you can recover your admin rights via the new administrator account. After that, you can reboot into your recovered admin account and delete the interim administrator account.
Note (Updated February, 3, 2021): The following fix applies to macOS High Sierra 10.13 and earlier. For macOS Mojave 10.14, macOS Big Sur 11 and later, fixing Mac no admin account via the “Command – S” (SUM = Single User Mode) route is not possible anymore. The updated fix therefore is found here: Fixing Mac No Admin Account On macOS Mojave Or Later
Normally, when you set up Mac OS X / macOS for the first time, your initial account will be an administrative one, allowing you to configure the system and install applications. Sometimes rare, errors that occur when upgrading, e.g. from OS x 10.10 Yosemite to OS X 10.11 El Capitan, or restoring from backup, or otherwise when making heavy modifications to the system, could result in your admin account being destroyed so you cannot log in to it or use it for changing system settings.
If it happens then one quick but well-known and convenient trick for recovering administrative status on a system trigger Apple’s Setup Assistant tool. This will run before any accounts have been loaded, and will run in “root” mode, allowing you to create accounts on your Mac.
Even though the Setup Assistant only runs once when you first install Mac OS X / macOS, it remains on your computer and is prevented from running by the presences of a hidden file called ‘.AppleSetupDone‘ in a system folder on your Mac. Therefore, to have the Setup Assistant run again so you can create a fresh admin account, you simply need to remove this file:
Easily recover lost admin right on Mac OS X 10.10 Yosemite, Mac OS X 10.11 El Capitan, macOS 10.12 Sierra, and macOS 10.13 High Sierra by reactivating Apple’s Setup Assistant tool. Be aware that this option is also a security risk to your mac.
Stay tuned! 😉