Anyone know how to reset Lion to the factory default ?

Dear Forum,


Up to Snow Leopard, there was a (inofficial) procedure to reset the operating system to its factory default with resetting the setup DB and removing all users entries. Unfortunately this procedure does not work anymore on Lion as the "com.apple.DirectoryServices.plist" doesn't exist anymore!


Anyone having an idea how to modify the procedure and to reset Lion?


Thanks a lot!

Mac Pro, MacBook Pro, MacBook, Mac mini, Mac OS X (10.6.4)

Posted on Jul 22, 2011 4:51 AM

Reply
10 replies
Sort By: 

Jul 22, 2011 5:04 AM in response to Thebestplacehere

The procedure in question would basically reset your system to the state when you bought your computer from the Store. This was very handy if one wanted to sell the computer without having to reinstall from scratch.


Of course all licensed software needs to be removed first, but the Apple software and system updates remain at their latest version.


Is not really a must have but was very helpful!

Reply

Jul 22, 2011 3:21 PM in response to aladdin

I have been able to accomplish this via the following method. I may not be the best idea given it deletes the account while logged in, but worked for me.


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


or


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

Reply

Aug 12, 2011 6:05 AM in response to markbjohnson

I might point out this apple kbase article:


http://support.apple.com/kb/HT4749


Specifically on how to run dscl in Single User. It says it's for Lion Server, but I had success with it on Lion Client as well. It simplifies your process so you can do the entire process from single user instead of having to do part of it logged in.

Reply

Apr 3, 2014 5:50 AM in response to doystin

Hi doystin,



Thanks for this worked a treat!


On my system the 'default' had a capital 'D' otherwise worked great.


restart in single user mode

mount -uw /

rm var/db/dslocal/nodes/Default/users/<shortname>.plist

rm -r users/<shortname>

rm var/db/.AppleSetupDone

reboot


D

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Anyone know how to reset Lion to the factory default ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.