Should you use these steps?
Back up or transfer your files
Sign out of iTunes
Sign out of iCloud
If using macOS Catalina or later, choose Apple menu > System Preferences, then click Apple ID. Select Overview in the sidebar, then click Sign Out.
If using an earlier version of macOS, choose Apple menu > System Preferences, click iCloud, then click Sign Out.
You will be asked whether to keep a copy of your iCloud data on this Mac. You can keep a copy, because you're erasing your Mac later. Your iCloud data remains in iCloud and on any other devices that are signed in to iCloud with your Apple ID.
Sign out of iMessage
Open the Messages app, then choose Messages > Preferences from the menu bar. Click iMessage, then click Sign Out.
Optional: Unpair Bluetooth devices that you’re keeping
If your Mac is paired with a keyboard, mouse, trackpad or other Bluetooth device that you plan to keep, you can unpair it. This optional step prevents accidental input when the Mac and device have separate owners but remain in Bluetooth range. If you do this on a Mac that doesn't have a built-in keyboard or trackpad, you will need to plug in a USB keyboard and mouse to complete the remaining steps.
To unpair a Bluetooth device, choose Apple menu > System Preferences, then click Bluetooth. Move your pointer over the device that you want to unpair, then click the remove (x) button next to the device name.
Erase your Mac and reinstall macOS
Follow the steps to erase your Mac and reinstall macOS.
After the macOS installation has been completed, your Mac will restart to a setup assistant. Press Command-Q to shut down instead of continuing the setup process.
Reset NVRAM and shut down
Turn on your Mac and immediately press and hold these four keys together: Option, Command, P and R. Release the keys after about 20 seconds. This clears user settings from the memory and restores certain security features that may have been altered. Learn more about resetting NVRAM.
After resetting NVRAM, your Mac will start up to the setup assistant again. To leave the Mac in an out-of-box state, press Command-Q to shut down instead of continuing setup.
Regardless of the model or condition of your device, we can turn it into something good for you and good for the planet: Find out how to trade in or recycle your Mac with Apple Trade In.