There are many reasons why you would want to perform a factory reset of your Mac. An obvious decrease in the performance level of your Mac is just one of them. Performing the factory reset requires at least a bit above average computer experience and knowledge because you will have to perform operations on your hard disk, and if they're done improperly, then you might lose your data.
In the tutorial below, I will show you some methods to properly restore your Mac to factory defaults. I will show you how to do this using the system functions.
The method of reinstalling the OS without wiping anything - Safe
This method involves using the Recovery feature to actually reinstall the operating system without messing with the Disk Utility to delete partitions.
Your data will remain exactly where it is, only the apps and the system files will be reinstalled while 3rd party applications will be deleted. However, additional files might not be deleted entirely from certain locations on the system partition.
1. Backup anything you need and reboot your Mac using Apple Logo > Restart.
2. While the Mac is booting, and you hear the chime sound, press Command + R until the Recovery menu appears.
3. Select Reinstall Mac OS X, choose the partition where your current operating system is installed.
4. Follow the on-screen instructions and that's it. At the end of the installation, your Mac will restart, and it will launch the customization menu.
5. Customize the Mac according to your preferences by selecting the date, adding your account, setting up iCloud, etc.
The method of wiping the drive and deleting partitions - Risky
This method will delete your partition, that's why it's absolutely necessary to backup your data first to an external drive or on a USB drive with enough storage. You will delete the primary partition where the OS is installed and then use the Reinstall MAC OS X function again.
Double check your data again and make sure you have everything backed up.
1. Repeat the procedure and reboot your Mac using Apple Logo > Restart.
2. Keep Command + R pressed and wait for your Mac to enter Recovery mode.
3. In Recovery mode, click on Disk Utility and press on Continue. The following window will appear:
Disk Utility - Erase operation
4. Identify the partition with the operating system on the left side and, with it selected, press on Erase. Leave the option for Format as default Mac OS Extended (Journaled) and assign a new name if you want.
5.Press on Erase and at the end of the operation, close Disk Utility.
6. While you are at the same Recovery menu, click again Reinstall Mac OS X and follow the on-screen instructions. The whole process might take a while depending on the performance of your Mac.
As you can see, the operations mentioned above can be safe or present a risk if you mistakenly delete the whole drive. While I recommend the second method, the first one can be used without worries since it does almost the same thing. No matter the option selected, in the end, you will have your Mac back to factory defaults. As always, it's highly recommended that you back up your data before doing any of these operations.