Back up any important data
Sign out of iCloud
Sign out of Messages
Sign out of iTunes or Music
Unpair Bluetooth devices if needed
Restart the MacBook Pro
Hold Command-R while it starts to enter macOS Recovery
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
Let the installation finish
Set up the Mac or shut it down if selling or giving it away
