How to completely reinstall Mac OS X? [duplicate]

You almost got it right, but you didn’t wipe the disk first. You’ll want to wipe Macintosh HD in recovery mode first (choose Disk Utility) then repeat the steps you took to install El Capitan.


No, you need to format the whole disk first!

Follow this guide to create a mac bootable usb key using createinstallmedia

To delete all the content of the hard disk make a linux bootable usb key. You can choose the distro that you prefer, insert it in the mac and hold option during the boot process, then start the system, open gparted and format all the disk.

Now insert the mac bootable media and run the installer pressing option during the boot, just wait and all will be fine.