Monday, 27 February 2012

How to reset Lion to the factory default

If you want to factory reset your Mac OS Lion back to the setup assistant you'll have to:

1) Do all of the necessary installations, etc. just as under Snow Leopard, using your setupacctname account.

2) Once that is done, BEFORE restarting in single user mode:
sudo su
dscl . -delete /Groups/admin GroupMembership setupacctname
dscl . -delete /Users/setupacctname
3) Reboot into single user mode (Hold Command-s at startup)

4) Check the filesystem:
/sbin/fsck -fy
5) Mount the filesystem:
/sbin/mount -uw /
6) Remove the setupacctname directory:
rm -R /Users/setupacctname
7) Remove or rename .AppleSetupDone so you get the language choice
cd /var/db/
mv .AppleSetupDone .RunLanguageChooserToo
rm .AppleSetupDone
8) Delete miscellaneous files (unnecessary, but useful if you're imaging the drive):
rm -R /Library/Caches/*
rm -R /System/Library/Caches/*
rm -R /var/vm/swapfile*
9) Shutdown or restart

On next boot your Mac will go to the start of the initial Apple Setup program just like when you first powered it on after purchase. All clean and ready to sell or give to a new user.

Another way of doing it is:

restart in single user mode by holding Command-S at startup and then run:
/sbin/fsck -fy
mount -uw /
rm var/db/dslocal/nodes/default/users/<shortname>.plist
rm -r users/<shortname>
rm var/db/.AppleSetupDone

Possibly Related Posts

No comments:

Post a Comment