Moving to a new Mac? Before taking these steps, you can use Migration Assistant to move your files from the old Mac to your new Mac.
Create a backup
Make sure that you have a current backup of your important files. Learn how to back up your Mac.
Sign out of iTunes in macOS Mojave or earlier
If you're using macOS Mojave or earlier, open iTunes. From the menu bar at the top of the screen or iTunes window, choose Account > Authorizations > Deauthorize This Computer. Then enter your Apple ID and password and click Deauthorize.
Learn more about deauthorizing computers used with your iTunes account.
Sign out of iCloud
If you're using macOS Catalina or later, choose Apple menu > System Preferences, then click Apple ID. Select Overview in the sidebar, then click Sign Out.
If you're using macOS Mojave or earlier, 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 click 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
If you're using OS X Mountain Lion or later, open the Messages app, then choose Messages > Preferences from the menu bar. Click iMessage, then click Sign Out.
Shut down your Mac, then turn it on 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 memory and restores certain security features that might have been altered.
Optional: Unpair Bluetooth devices that you’re keeping
If your Mac is paired with a Bluetooth 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 of each other.
If you're unpairing Bluetooth input devices from a desktop computer such as an iMac, Mac mini, or Mac Pro, you must plug in a USB keyboard and mouse to complete the remaining steps in this article.
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 hard drive and reinstall macOS
The best way to restore your Mac to factory settings is to erase your hard drive and reinstall macOS.
After macOS installation is complete, the Mac restarts to a setup assistant that asks you to choose a country or region. To leave the Mac in an out-of-box state, don't continue setup. Instead, press Command-Q to shut down the Mac. When the new owner turns on the Mac, the setup assistant guides them through the setup process.
No matter the model or condition, we can turn your device into something good for you and good for the planet: Learn how to trade in or recycle your Mac with Apple Trade In.