If you plan to sell your Mac for some reason you might want to restore it to the out-of-box state. For this, you could consider reinstalling macOS on it, which would clean up your data or Apple ID from your Mac.
There are a few more steps you need to perform before reinstalling macOS such as creating a backup of your data and signing out of iTunes, iCloud and iMessage. Once these are done you are ready to proceed.
Do note that to download and reinstall macOS using recovery, you will need an internet connection that meets a set of requirements such as the following:
The connection should be configured to use Dynamic Host Configuration Protocol (DHCP) over Wi-Fi or ethernet. Make sure the connection does not use 802.1X or other certificate-based authentication or proxy server.
If the internet connection uses WEP or WPA-Enterprise security protocols, you can use macOS recovery. If it is on a captive network then use macOS recovery not macOS Internet Recovery. Once a proper connection is established, perform the following steps to reinstall macOS.
How to reinstall macOS Sierra
- Start your Mac from recovery. For this hold down Command + R keys immediately after turning on or restarting your device. When you see the utilities window, know that the Startup process is complete
- Launch Disk Utility from the utilities window then use Disk Utility to erase your built-in hard disk through Mac OS Extended (Journaled) format. When the process is done quit Disk Utility
- From the options under macOS Utilities, select Reinstall macOS then follow the onscreen instructions. This process will install macOS Sierra
- When the process is complete, your Mac restarts to a setup assistant. At this moment press Command + Q keys, then click Shut Down. You can now complete the steps of the setup assistant using your details.
If you are reinstalling macOS Sierra for reasons other than selling:
- Put your mac in Recovery by holding down Command-R key soon when you power-on or restart your Mac. Release the keys when the Apple logo appears on the screen
- If you want to erase your disk after reinstalling, open Disk Utility from the utilities window, then use Disk Utility to erase the disk. Quit Disk Utility when the process is complete
- Select Reinstall macOS from the utilities window and follow the on-screen prompts
There are other ways to reinstall macOS Sierra, one of which is through the Time Machine backup. In case you have created one, you can restore macOS from that backup. But note that doing so will erase the disk you are restoring, then replace it with macOS Sierra and other data from the backup you made.
To reinstall macOS Sierra, enter into recovery, then choose Restore From Time machine Backup and follow the instructions appearing on the screen to complete the process.
Alternatively, reinstall macOS from the Mac App Store.