10 Replies Latest reply: Apr 3, 2014 5:50 AM by davemotion
aladdin Level 1 (140 points)

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)
  • Thebestplacehere Level 3 (705 points)

    Is restore deafults in some apps like system preferences in some panels but the one you say like a general one i don't know if is in lion.

  • aladdin Level 1 (140 points)

    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!

  • markbjohnson Level 1 (10 points)

    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

  • Pondini Level 8 (38,740 points)

    Start up from the Recovery HD (See Using the Recovery HD) and click Get Help Online

  • tonyfromraleigh Level 1 (5 points)

    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.

  • doystin Level 1 (0 points)

    another/easier way of doing it is:

     

    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

     

    i've been using that on multiple OS's for years.

  • itunes_tls Level 1 (0 points)

    dude, your fix ruled.  thanks for helping out.    

  • itunes_tls Level 1 (0 points)

    thanks for the link.

  • DribbleCastle Level 1 (0 points)

    Thanks for the info Mark.   Worked like a charm!

  • davemotion Level 1 (0 points)

    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