Ga door naar hoofdinhoud

Model A1311 / Mid 2010 / 3.06 & 3.2 GHz Core i3 or 3.6 GHz Core i5 Processor

343 Vragen Bekijk alle

How to Delete ALL users from a macOS system to prepare it for sale

Hello. The "remove .AppleSetupDone" trick has been around for years to trigger the Setup Assistant to start again on the next boot. I've been using this to allow me to setup a used Mac for sale that has all the latest macOS updates as well as some additional basic free apps installed like Malwarebytes, VLC, OpenOffice, etc. that I think give it some additional value for my buyers. Sonoma breaks this I understand but that's not my concern. My concern is, when I setup a user, that "account" seems to still exist. I know this because if I try to setup the mac again after "resetting" it, I cannot reuse the previous username. For example, if the mac was setup with a user named "user", after deleting .AppleSetupDone and rerunning setup, if I try to use "user" again it automatically changes it to "user1". It will not let me use "user". If you look at the steps I use to accomplish this you will probably know why - none of these steps actually removes the "account". It removes the directory, yes. But the account still exists somewhere. Here is what I've been doing:

Big Sur/Monterey (From Recovery Terminal, not Single User)
csrutil disable
rm /Volumes/Macintosh\ HD/var/db/.AppleSetupDone
rm /Volumes/Macintosh\ HD/Library/Keychains/apsd.keychain
rm -rf /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/
rm -rf /Volumes/Macintosh\ HD/Users/user
csrutil enable

Older versions of these commands also had

sudo /usr/bin/dscl . -delete "/Users/<username>"

but I could never get that command to do anything but produce an error. I see a version of that command mentioned in other sources when I google "how to remove a user account through terminal in macOS". But none of those links seem to be applicable to a system booted from recovery mode.

Apparently there is a new command

sysadminctl -deleteUser $username

but again, that seems to only work when booted normally and signed in to an admin account. I hope I have explained this well and someone can shed some light on how to accomplish what I need.

Thanks in advance,


Beantwoord deze vraag Dit probleem heb ik ook

Is dit een goede vraag?

Score 0
Voeg een opmerking toe

1 Antwoord

Het nuttigste antwoord

I haven’t played with using your approach, nor with the newer macOS’s so this might not achieve what you want.

I always use an external drive to boot the system which I’m cleaning reformatting the active partition following the Apple T/N What to do before you sell, give away, trade in, or recycle your Mac

Technically Apple doesn’t have a user partition setup on a new system only the hidden OS volumes How do I Access These 3 Hidden Volumes within APFS. You will need to erase them as I believe one holds the user account list (nothing more) but you still have iCloud and the system password to also flush

While you want to add value Apple frowns on that and that’s the rub. The better approach which I do is setup a bootable rescue drive and within I setup additional utilities with a desktop image which has written instructions.

Was dit antwoord nuttig?

Score 1
Voeg een opmerking toe

Voeg je antwoord toe

Larry Jorgenson zal eeuwig dankbaar zijn.

Afgelopen 24 uren: 0

Afgelopen 7 dagen: 6

Afgelopen 30 dagen: 30

Altijd: 165