Before you sell or give away your Mac, iMac or Macbook, you need to securely erase its contents and reinstall the OS. Passing on a cleanly installed Mac isn't just good manners, it's critical to your personal security. You need to ensure that you pass on only hardware and software, and not your personal data. Here's how to wipe a Mac - you'll need the install discs that came with it. (See all of our iOS and OS X tutorials.)
How to erase a Mac's hard drive: wipe a Mac
Before we start it's important to note that the following procedure will completely erase your hard drive. You will lose any files you haven't already copied, and all partitions will be deleted. It's also worth getting a wired mouse. You'll need a mouse and, although OS X allows you to install one during this process, in our view it is simpler just to use a traditional wired rodent. When you are ready to go, restart your Mac.
Pop your OS X install discs into the DVD drive. If you are running Mac mini or MacBook Air you should have a USB install disk - put that in. As the computer is starting hold down the C button on the keyboard. Your Mac will boot from the install disc or disk.
You'll be asked to choose a language. Choose one you can understand and then press the right arrow key. Now click the Utilities menu and choose the Disk Utility.
Now select the volume you wish to erase. Unless you have changed it this will be called Macintosh HD. If you have multiple volumes partitions you'll have to repeat this procedure for each one before passing on your computer.
Now take one final moment to make sure you have everything you need from the hard drive. If you have, have, hit the Erase tab. Another dialog will click up to ask you if you are sure: click yes and OS X will now completely erase your hard drive.
Once the partition is erased, choose Disk Utility, Quit Disk Utility.
How to reinstall OS X
Of course it's likely that you want your Mac to be more than just an admittedly attractive doorstop. So now you should reinstall OS X.
Click Continue, and review the installation license agreement to install OS X. You have to agree to the terms and conditions (after a careful and close reading, of course), so hit Agree. Now you have to choose the drive you wish to install. We presume it will be the Macintosh HD disk you you just erased.
Simply hit Install, and then Continue. When the process is finished you will be asked to Restart, and then you have a brand new Mac on your old hardware.
See also: MacBook or iPad: What should you buy?