Salta al contenuto principale

Modello A1311 / Metà 2010 / Processore Core i3 da 3,06 e 3,2 GHz o Core i5 da 3,6 GHz

342 Domande Visualizza tutte

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

Rispondi a questa domanda Anch'io ho questo problema

Questa è una buona domanda?

Punteggio 0
Aggiungi un commento

1 Risposta

Risposta Più Utile

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.

Questa risposta è stata utile?

Punteggio 1
Aggiungi un commento

Aggiungi la tua risposta

Larry Jorgenson sarà eternamente grato.
Visualizza Statistiche:

Ultime 24 Ore: 0

Ultimi 7 Giorni: 5

Ultimi 30 Giorni: 17

Tutti i Tempi: 139