Moving to a new Mac?
Learn how to move your files to your new Mac. Do this before you erase the hard drive or follow any other steps.
Create a backup
Be sure you have an up-to-date backup of your important files and data. Learn how to back up your data in macOS.
Sign out of iTunes
Open iTunes. From the menu bar at the top of your computer screen or at the top of the iTunes window, choose Account > Authorizations > Deauthorize This Computer.
When prompted, enter your Apple ID and password. Then click Deauthorize.
Learn more about deauthorizing your computer using iTunes, including how to deauthorize all the computers you've used with your iTunes account.
Sign out of iCloud
Choose Apple () menu > System Preferences, click iCloud, and then click the Sign Out button.
A dialog asks whether you want to keep a copy of your iCloud data on the Mac. Because you'll reformat the hard drive in a later step, just click Keep a Copy to proceed.
After you sign out of iCloud, your iCloud data remains in iCloud and on any other devices you've signed into with your Apple ID.
Sign out of iMessage
If you're using OS X Mountain Lion or later, sign out of iMessage.
In the Messages app, choose Messages > Preferences, then click Accounts. Select your iMessage account, then click Sign Out.
If you're keeping paired Bluetooth devices, unpair them (optional)
If you have Bluetooth devices — such as keyboards, mice, or trackpads — paired with your Mac, and you plan to keep these devices, you can unpair them. This optional step prevents accidental input on the Mac if the computer and the Bluetooth devices have separate owners but remain within Bluetooth range of one another.
If you're unpairing an iMac, Mac mini, or Mac Pro, you must have a USB or other wired keyboard and mouse to complete these steps.
To unpair your Bluetooth devices, choose Apple menu > System Preferences, then click Bluetooth. Hover the pointer over the device that you want to unpair, then click the remove (x) button next to the device's name. When the dialog asks if you're sure, click Remove.
If you're using an iMac, Mac Pro, or Mac mini, use a USB or other wired keyboard and mouse to complete the next step.
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 Welcome screen and asks you to choose a country or region. If you want to leave the Mac in an out-of-box state, don't continue with the setup of your system. Instead, press Command-Q to shut down the Mac. When the new owner turns on the Mac, setup assistant will guide them through the setup process.
Optional step for MacBook Pro with Touch Bar
If you use a third-party utility to erase your MacBook Pro with Touch Bar — or if you use another method such as target disk mode — you might want to take this additional step to ensure that all information is cleared from the Secure Enclave in the Touch Bar. Start up from macOS Recovery by holding down Command-R on your keyboard immediately after pressing the power button to turn on your Mac, or immediately after your Mac begins to restart. When the macOS Utilities window appears, choose Utilities > Terminal in the menu bar. Type this command in Terminal:
Press Return, type yes when asked if you're sure, and then press Return again. Finally, choose Terminal > Quit Terminal.