leroydouglas wrote:
HWTech wrote:
If you have no macOS admin user accounts or cannot log into a macOS admin user account, then you will need to start over by erasing the system & restoring from a backup.
There are no other options for creating a macOS admin user account when using macOS 14.x+.
are you definitively saying the instructions supplied in the Jonas_TheM post is invalid...?
" you can regain admin access without wiping your device! "
ref: Restoring Lost Administrator on macOS Son… - Apple Community
I was referring to the old method which involved deleting the ".AppleSetupDone" file which the OP referred and for which @Barney-15E has a User Tip.
Restarting Setup Assistant to create Admin user account - Apple Community
I hadn't seen @Barney-15E's post when I wrote my reply. Technically I am still correct since the link here for "Restoring Lost Administrator on macOS Sonoma" is converting an existing Standard user account to an admin account and not creating a new account. I know, its quibbling. ;-)
I believe that modifying the "sudoers" file will work. But that is a very risky edit which could prevent all macOS user accounts from being accessed if the entry is not created correctly or an existing entry is deleted.
Personally I would have advised creating a new file with that entry within the "sudoers.d" subfolder which is much safer & equally effective. Plus it is risky making edits without using the "visudo" command which also verifies the "sudoers" file permissions & checks for syntax errors, but that is not available within Recovery Mode (another reason to create a new file instead). And I would recommend removing the added entry to the "sudoers" file using "visudo" once the account is returned to admin status just as a safety precaution.
Thanks for checking. I'm glad to clarify things here. It also reminds me that I need to do better at quoting sections to which I'm referring.