I have a Macbook Air, and I am logged into an administrator account which I want to delete. Is there a way to delete the account I am currently logged into while using that account?

  • What have you tried, but failed to accomplish, to this end? Is creating a second administrator account to delete the first account not feasible for some reason? – IconDaemon Dec 10 '19 at 23:33
  • 1
    @IconDaemon Please check the question history of jr123456jr987654321. Reading all questions it appears to be a XY-problem. – klanomath Dec 10 '19 at 23:40
  • Unfortunately it is not feasible to create another administrator account due to personal reasons. – jr123456jr987654321 Dec 10 '19 at 23:45
  • ...I think you could boot into single user mode and use the userdel command? You should definitely make a backup first, because I'm not sure what would happen if, for example, there were no admin accounts left on the computer. But it should work in theory. – Wowfunhappy Dec 11 '19 at 2:04

The closest you can get to delete your admin with the name admin_username (even with no other user left afterwards) without logging in as a different user in the GUI is to enable root and remove your admin with the superuser:

  1. Open Terminal.app
  2. Enable root with dsenableroot. You have to enter your admin_username password and choose a new password for root and verify it.
  3. Change to root: su - and enter root's password.
  4. Enter:

    rm -dR /Users/admin_username; dseditgroup -o delete -n . -u admin_username admin; dscl . delete /Users/admin_username; reboot

    The password of admin_username is probably required. I ran several tests with various permutations of the command above and either dseditgroup or dscl asked for it.

    Warning: This will remove all admin_username files & folders! Most files can be recovered with a data recovery tool.

Afterwards the root user will be enabled and depending on your settings it will be visible as "Other users..." on the login screen.

The command was tested in a virtual machine. The admin user had a relatively small user folder (< 5 GB). On a real machine your milleage may vary.

Reading and interpreting all related questions and comments I suspect that the MacBook Air is a shared computer with two admin accounts belonging to different parties (PvsP/PvsB) being at loggerheads in the meantime.

I would hand over the computer to a wise, reliable and neutral person, explain the dilemma and expect a Solomonic solution.

  • Would you be able to run this command in recovery mode? – jr123456jr987654321 Dec 11 '19 at 11:19
  • @jr123456jr987654321 It may be possible - I have to check this. – klanomath Dec 11 '19 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .