Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

How to reset Lion back to the Setup Assistant Install
There have been previous hints on how to reset earlier versions of Mac OS X to delete users so that it boots to the Setup Assistant again. This can be useful if you are passing on or selling your computer to someone else. The most recent hint was posted in 2007 for Mac OS X 10.5 and there were significant corrections included in the comments. There is also a command that changed in 10.7 (also in the older hint’s comments) and even with the modifications suggested in the comments, the hint is still incomplete.

So instead of adding yet another modification in the comments of a hint related to 10.5, I thought I would submit a new hint brining everything together from the old hint, its comments, changes needed for 10.7, and the missing items I have found. This provides a current version of the hint for 10.7 and presumably 10.8, though I have not been able to test on Mountain Lion.

1: Remove references to, and the stored passwords for, your local WiFi network.
  • In the Finder, choose Go > Utilities.
  • Open Keychain Access in the Utilities folder.
  • If you don’t have a list of keychains on the left, choose View > Show Keychains.
  • On the keychains list on the left, select the System keychain. There should be an AirPort network password item in the list for your local WiFi network. Select it and press Delete. Confirm that you want to delete the item and quit Keychain Access.
  • Go to System Preferences > Network
  • Select Wi-Fi from the list on the left and click the Advanced button on the bottom right.
  • In the‘Preferred Networks: list, select your network and click the minus button below the list.
  • Click OK and then Apply button in the main Network Preferences window.
  • Click Turn Wi-Fi Off, then click it again to turn Wi-Fi back on. It should not connect to your network anymore (and should ask for a password if you try).
2: Still in System Preferences, click Show All at the top left and then click the Users & Groups icon. Delete all users except for the one you are currently logged in as. In the rest of this hint, this remaining user will be referred to as USERNAME.

3: Boot your Mac into single user mode by restarting and holding down Command-S at startup.

4: Mount the filesystem in write mode and delete the USERNAME home directory.
$ mount -uw /
$ rm -R /Users/USERNAME/


5: Load OpenDirectory so we can remove the system’s record of USERNAME.
$ launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

6: Find the UID of USERNAME.
$ dscl . -read /Users/USERNAME GeneratedUID
In the next step, type in this UID where you see GENERATEDUID written.

7: Remove USERNAME from the systemwide admin group and then remove USERNAME’s record.
$ dscl . -delete /Groups/admin GroupMembers GENERATEDUID
$ dscl . -delete /Groups/admin GroupMembership USERNAME
$ dscl . -delete /Users/USERNAME


8: Remove the Setup Assistant flag so that it runs when the Mac is started up.
$ rm /var/db/.AppleSetupDone

9:[optional] Remove the cache files and virtual memory swapfile.
$ rm -R /Library/Caches/*
$ rm -R /var/vm/swapfile*


10: $ shutdown -h now

If you want to check that the Setup Assistant will run, you can turn on your Mac. When the Setup Assistant starts, just press cmd-Q on the keyboard and you will be prompted to shut down. Your Mac has been reset.

[kirkmc adds: I'm running this hint because it contains a lot of useful information. But I wonder why one can't simply erase the hard disk and re-run the installer to get everything back to its initial state. That seems a lot easier to me…]
    •    
  • Currently 3.00 / 5
  You rated: 1 / 5 (14 votes cast)
 
[39,113 views]  

How to reset Lion back to the Setup Assistant | 18 comments | Create New Account
Click here to return to the 'How to reset Lion back to the Setup Assistant' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to reset Lion back to the Setup Assistant
Authored by: michelle_eris on Dec 05, '12 07:49:07AM

I agree with kirkmc; why not just erase the disk and reinstall the OS?



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: gopes on Dec 05, '12 08:02:04AM

I've done this so I can update & install software before handing it to tech-shy/novice people who won't, for example, know about installing Flash, but who should choose their own password.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: nickv2002 on Dec 05, '12 11:29:38AM

Exactly.

I've also done it before selling a computer after doing a clean install to make sure all the software I was selling with it was installed/registered (for stuff like iLife).

Edited on Dec 05, '12 11:29:50AM by nickv2002



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: glusk on Dec 10, '12 08:12:28AM

I'll add a "mee too". I've done this over the years when gifting my old machines to my family. It makes the machine feel new to them while having 3rd party things already installed.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: agentx on Dec 05, '12 08:04:18AM

Unconvinced this is needed as any machine should be fully wiped/reloaded with OS before passing on and any machine you get second hand should be wiped and reinstalled as a precaution anyway.

The best use of these commands/hint is for fixing OpenDirectory issues (users DB corruption)
I have had to use these commands in the past to fix hosed accounts during an upgrade/update etc.






[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: jolinwarren on Dec 05, '12 12:30:03PM

Wiping and re-installing on a used computer you receive might be good practice. But I can assure you that the majority of 'normal' people who are buying second-hand machines to have a cheap computer just use what arrives in the box. That's why it's nice to update the software and reset to the Setup Assistant for the non-tech person who might receive your old Mac.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: zsoul on Dec 05, '12 08:05:31AM

The reason I would do this is if I wanted to deploy a system with custom applications already installed. You can go through this process once, then make a disk image to restore onto multiple machines.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: nilness on Dec 05, '12 08:41:07AM

Thanks for the well written instructions. I've been using similar instructions going back to the 10.4 days. I've gotten a lot of helpful info from Mac OS X Hints over the years to make it happen!

As gopes pointed out, this is extremely useful to use, say, in a script so that you can fully update, setup, etc. a machine before handing it off to the end user or imaging it for deployment.

And since we're talking about resetting Lion here, short of other shortcuts, for many users erasing and reinstalling means starting with 10.6, updating to gain access to the App store, downloading >4GB, installing 10.7, and running software update. Pretty time consuming just to remove a user account.

As agentx suggests, any machine being transferred from owner to owner should be wiped and erased first by the original owner, and again by the new owner. Sure, zeroing the data and doing a full install & update of the operating system TWICE IN A ROW may require a lot of time, a fair amount of effort, and no small amount of technical knowledge, but to borrow a line from Aliens, "It's the only way to be sure"

For any place that has to set up more than a few units for sale/deployment/imaging/whatever, it's invaluable to be able to get all software updates & installs done to a machine and then reset it to the welcome sequence.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: David Allen on Dec 06, '12 11:38:50AM

You would only need to start with Snow Leopard if the Mac has only had Leopard or Snow Leopard installed on it. Or if it is an older Mac with a new HDD. If the Mac has already had either Lion or Mt Lion and does not have a new HDD or it shipped with Lion or Mt Lion, then there is no need to install Snow Leopard, you would use OS X Recovery;
http://support.apple.com/kb/HT4718

Or if it is one of the following models that did not ship with Lion or Mt Lion, the EFI firmware can be updated to use OS X Recovery;
http://support.apple.com/kb/HT4904

Yes, it requires an internet connection and yes, you will need to download the installation at 4 to 5 GB.

---
Dah•veed |David Allen|
Monterrey, NL, Mexico



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: pete on Dec 05, '12 08:43:35AM

So this would be an ideal way to delete my present account, which for some reason or other, has a few things missing in it, mainly the ability to eject any disk or mounted disk image without having to go to Disk Utility?

On re-booting, just restore from Time Machine and all should be working as it should... right?



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: BMarsh on Dec 05, '12 08:50:55AM

This is very useful for anyone who prepares used macs for sale.
Many times a mac of a year or more older would install to an OS version that isn't the latest, and isn't the best user experience to get a "new" mac, then have to spend a couple of hours downloading updates.
With this method you can setup a generic user after the fresh install, do all of the updates, and any freeware/shareware programs that people may find useful, then do the prep steps in this hint.

There will likely still be a handful of updates depending on how long between prep & purchase, but especially with some of the iLife updates being over 1 GB and the Combo updates being close, it really is better customer service.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: baltwo on Dec 05, '12 06:37:49PM

If you're doing this often, it's better to make a generic clone or netrestore-type of image and install that after erasing and zeroing out the data on the HD. No commands and reusable. Just ensure you provide the discs for all those 3rd-party apps you put on the machine that aren't freeware.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: jolinwarren on Dec 05, '12 12:26:00PM

When preparing a Mac for sale/passing on, I do wipe the drive (usually with seven-pass data overwrite) and reinstall the OS. But as others have said, if you want to install software such as the iLife that came with the computer, you need to create an account to do so. I also include the original disks, but most computer users aren't tech-savvy enough to install the software if it's not on the drive. I also run software update as others have mentioned. My experience in technical support for friends shows that non-tech people often don't install updates even though you get notified and it's a one-click process. I consider it good manners when selling a Mac to ship it in an up-to-date condition that provides a proper 'out of the box' experience (I.e. the Setup Assistant). Hence this hint. :-)



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: Unsoluble on Dec 05, '12 09:19:11PM

I approach passing on computers to others exactly the same way; your work on this hint is much appreciated. :)



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: robertcoogan on Dec 06, '12 05:03:59AM

A lot of this is superfluous...why not just reinstall?



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: Unsoluble on Dec 06, '12 10:19:25AM

Reading comments is hard, I guess.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: Demani on Dec 07, '12 02:55:03PM

I do this at work all the time. When someone gets a new Mac they bring it to me first (or have it shipped to me directly). Then I put on all the stuff we need, configure the VPN, install Chrome and Firefox, create shortcuts and add any documentation. Then I reset and let them take it home to set up, with everything ready to go.

Disk Images work if you have a lot of the same model, but since I get a machine in about every 3 months that needs to be set up this way I just do this- there would be too much updating needed to make it more efficient (and again, either the updates get run beforehand on the image, or I need to do them after creating an account).

Also, very nice when setting up a machine as a gift. I can put on a Humble Bundle or something similar, and still let them set up their account info.



[ Reply to This | # ]
How to reset Lion back to the Setup Assistant
Authored by: appleexaminer on Jan 01, '13 01:27:22PM

This hint goes thru many steps to "reset" an OS X system, however, data is still all available for recovery. When getting rid of your Mac, always do at least a 1-pass secure erase of the entire internal storage.

AppleExaminer.com shows many ways that OS X and iOS data is recovered for analysis.

Best wishes to all and thank you for this great site!



[ Reply to This | # ]