(Even though the software is bundled with Mac OS X, it's worth noting that Carbon Copy Cloner is now a paid-for app).
Step 2: De-Authorising iTunes
You should deauthorize your computer from iTunes. This means that it will no longer be linked to your iTunes account. You can only use up to five Macs to play music and movies that are locked to your iTunes account, so you shouldn't pass that on to another person. Open iTunes and click Store > De-authorise This Computer. Enter your Apple ID and password and click De-authorise.
Step 3: Turn off FileVault
FileVault encrypts the files on your hard drive, and it's better to turn it off before going any further (you'll be wiping the files soon so security shouldn't be a concern). Open System preferences and click on Security & Privacy and FileVault. Check that it says FileVault is turned off the for the disc [main hard drive]. If not click on the padlock icon in the bottom left, enter your password and click on Unlock. Now click Turn Off FileVault.
Step 4: Disable iCloud
Open System Preferences and click on iCloud and tap on Sign Out Now. To remove all your personal data, click 'Delete From Mac' on each popup (although you'll be wiping the hard drive in the next step anyway).
Step 5: Restart the Mac in Recovery Mode
First of all make sure you are connected to the Internet (open Safari and browse around). You need an internet connection to install Mac OS X. Restart the Mac by clicking on Apple > Restart and hold down the Command and R keys until the Recovery Mode Utilities window appears.
Step 6: Erase the drive
Select Disk Utility and click on Continue. Now choose your main Startup Volume (typically called Macintosh HD in the sidebar on the left, and click on Unmount. Now choose the Erase tab and click Erase to wipe your hard drive. Note that this permanently erases all data on the hard drive so don't do this unless you've cloned the drive or are happy to never have to get something from that drive again. When it's finished exit the program by choosing Disk Utility and Quit Disk Utility.
Step 7: Select Re-install Mac OS X
Sign up for CIO Asia eNewsletters.