Back up your Mac with Time Machine or another backup method
Sign out of iCloud
Sign out of iMessage
Sign out of FaceTime
Sign out of Apple Music and other Apple services if needed
Unpair Bluetooth devices if desired
Shut down the Mac
Start up in macOS Recovery
On Apple silicon Macs, press and hold the power button until startup options appear, then choose Options
On Intel Macs, restart and immediately hold Command-R
Open Disk Utility
Select the startup disk
Click Erase
Choose APFS or Mac OS Extended if prompted
Confirm the erase
Quit Disk Utility
Select Reinstall macOS
Follow the on-screen instructions
Complete setup or shut down if selling or giving away the Mac
