Choose Apple menu > Restart, and then hold down the Command (⌘) and R keys while the computer restarts.

Select “Disk Utility” and then click Continue.

Select your startup disk from the list on the left, and then click the Erase tab.

From the Format pop-up menu, select Mac OS Extended (Journaled), type a name for your disk, and then click Erase.

After the disk has been erased, choose Disk Utility > Quit Disk Utility.

If you’re not connected to the Internet, choose a network from the Wi-Fi menu in the right corner of the menu bar (in the top-right corner of the screen).

Select Reinstall Mac OS X, click Continue