Zum Hauptinhalt wechseln

Modell A1311 / Mitte 2010 / 3,06 & 3,2 GHz Core i3 oder 3,6 GHz Core i5 Prozessor

343 Fragen Alle anzeigen

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,

Larry

Diese Frage beantworten Ich habe das gleiche Problem

Ist dies eine gute Frage?

Bewertung 0
Einen Kommentar hinzufügen

1 Antwort

Hilfreichste Antwort

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.

War diese Antwort hilfreich?

Bewertung 1
Einen Kommentar hinzufügen

Antwort hinzufügen

Larry Jorgenson wird auf ewig dankbar sein.
Seitenaufrufe:

Letzte 24 Stunden: 2

Letzte 7 Tage: 7

Letzte 30 Tage: 33

Insgesamt: 172