How do I erase my user data without erasing my hard drive? Or I want to sell my Mac on eBay, but I want to run Software Updates and install other applications before I send it out. Doing so can really increase your Mac’s resale value. What’s the best way to do that?
It seems to me that what most people are asking is: How do I “start over” without completely erasing my hard drive? This short hint shows you a few ways you can start over with a new user account if you don’t want to erase everything.
Creating a New User Account
If your only goal is to delete your user account and create a new one for yourself, this is easy to accomplish, so let’s start with that one (go down to the next section to see how to more completely prep your Mac for resale without erasing the hard drive):
- First, open System Preferences and click on the Accounts preference. What we need to do is create a new user account with administrator privileges, so we need to make sure that the padlock in the lower left-hand corner is unlocked. If it’s locked, click it and your computer will ask you enter your administrator password.
- Once this is complete, you can click the plus button directly above the padlock. A window will open, allowing you to create your new account. Here’s what it will look like:
- As you can see above, we need to do five things in this window. First, you want to make the new account an Administrator account so that the new account has access to all the computer’s functions.
- Next, put in the user’s name for the new account (which should automatically fill in the short name, but you can change it here if you want).
- Finally, enter a password (and again under Verify), then click “Create Account.”
After you have created the account, you can quit System Preferences and log out of your account (Apple menu → Log Out). When you arrive at the Mac’s login screen, you should log into the new account you created. Once in the new account:
- Open System Preferences again, and go the Accounts preference.
- You’ll want to again make sure the padlock in the lower left corner is unlocked. Then, click on the old account you want to get rid of, and click the minus button above the padlock. You’ll get this window to appear:
- Here, you can make a choice with what you want to do with data from the account you’re erasing. If you want to completely get rid of the data (make sure you’re ready to do this!), click Delete the home folder. If you want to leave the user folder intact in the Users folder (this is rare but useful if you still need to access the data), click Do not change the home folder. The data will still be there, but you can no longer log in as that user. Finally, you can click Save the home folder in a disk image if you want the computer to delete user account (so that it is absent from the Users folder and you can no longer log into that account). This option will copy all of the data and put it into a disk image on your Desktop so that you can access the data if you still need to.
- Once you’ve deleted the old account, your new account becomes the default account (if it is the only other account on the computer), and when you restart, it should log you into your new Desktop.
Make Your Computer Start Up with the New Computer Setup Program
Remember when you first got your Mac? When you first turned it on, it booted into a flashy video sequence before it had you begin configuring your users and settings. You may know that if you restore your computer from the original DVDs that you can achieve the results, but what if you don’t want to erase the hard drive? You can achieve the same thing, but you’ll have to be OK with running some terminal commands.
This is definitely a more advanced tip, can be difficult to learn at first, and you can screw things up. Please make sure it’s what you want to do.
- First, you need to reboot your machine in single-user mode. This mode will start the computer up in a text-only terminal (kind of like a Unix version of DOS). You won’t get any windows or graphicsTo start up in single-user mode, turn your computer on while holding down the Command and “S” keys until your screen begins to show text (rather than the spinning Apple logo).
- Eventually, the text will stop loading, and you’ll be left at a prompt with the pound key: #. Once you’re there, I’m going to have you type a few things. Make sure you type it exactly as I have written it (hit the Return key at the end of each line):
mount -uw /
What we did here was tell the computer to make your hard drive readable and writable. I’m now going to have you type the command that will erase all of your users’ data. If you don’t want to do this for some reason, don’t type the next line and continue to the next paragraph. I assume you want to erase your personal data, however, since you want the computer to start up as though it’s brand new.
rm -rf /Users/*
The above command says to remove absolutely everything in the Users folder (make sure you type shift-8 to make the asterisk symbol at the end of the line).
Now, type this:
cd /var/db/ rm .AppleSetupDone rm .TimeMachine.Cookie rm .TimeMachine.Results.plist rm .com.apple.iokit.graphics rm -rf dhcpclient rm -rf samba
Whew! We had a bunch of commands there. Basically, these are settings and preference files for some programs on the Mac, and we want those to be reset when the computer turns back on. The most important file to remove is the .AppleSetupDone file (and yes, it does start with a period). When this file is present, the computer boots up normally. When it is absent, the computer thinks you’re turning it on for the first time and boots up to the flashy set up program.
We’re done, so you’ve got two choices: if you want to shut the computer down, type:
shutdown -h now
If you want to reboot the computer (to check out your handy work), type:
That’s it! With the above steps, you can install whatever software you like, then make your computer act like it’s brand new.
How did this tutorial work for you? Was it too complicated? Do you have an easier way of accomplishing the same task? Ask questions and give feedback in the comments.