Back up your data with Time Machine or another backup method
Sign out of iCloud, iMessage, and FaceTime
Open System Settings or System Preferences
Go to General
Select Transfer or Reset
Choose Erase All Content and Settings
Follow the on-screen prompts
Enter your administrator password if asked
Confirm the erase process
Wait for the Mac to restart and complete the reset
Set up the Mac again or shut it down if you are giving it away
