Back up and restore your Mac
To keep your files safe, it’s important to back up your Mac regularly. The easiest way to back up is to use Time Machine—which is built into your Mac—to back up your apps, accounts, settings, music, photos, movies, and documents. (Time Machine doesn’t back up the macOS operating system.) Use Time Machine to back up to an external storage device connected to your Mac or to a supported network volume. For a list of devices supported by Time Machine, see the Apple Support article Backup disks you can use with Time Machine.
Set up Time Machine. Make sure your iMac is on the same Wi-Fi network as your external storage device, or connect the storage device to your iMac. Open System Settings, click General > Time Machine, then click Add Backup Disk. Select the drive you want to use for backup, and you’re all set.
Back up with iCloud. Files in iCloud Drive and photos in iCloud Photos are automatically stored in iCloud and don’t need to be part of your Time Machine backup. However, if youʼd like to back them up, do the following:
iCloud Drive: Open System Settings, click Apple ID, then click iCloud and deselect Optimize Mac Storage. The contents of your iCloud Drive will be stored on your Mac and included in your backup.
iCloud Photos: Open Photos, choose Photos > Settings, then click iCloud and select “Download Originals to this Mac.” Full-resolution versions of your entire photo library will be stored on your Mac and included in your backup.
Restore your files. You can use Time Machine to restore all your files at once. Click the Time Machine icon in the menu bar, then choose “Browse Time Machine backups.” (If the Time Machine icon isn’t in the menu bar, choose Apple Menu > System Settings, then click Control Center in the sidebar. Click the pop-up menu next to Time Machine on the right, then choose an option.) Select one or more items that you want to restore (individual folders or your entire disk), then click Restore.
If you use Time Machine to back up your Mac, you can recover your files if the operating system or startup disk is damaged. To do this, you must first reinstall macOS on your Mac before you can restore your files using your Time Machine backup. Read on for more information.
Reinstall macOS. Your operating system files are kept separate from your personal files in a sealed system disk. However, some actions, like erasing or inadvertently damaging a disk, require that you restore your iMac. You can reinstall macOS and then use Time Machine to restore your personal files from your backup. With macOS Big Sur and later, there are several ways to restore your Mac. You may be required to install a newer version of macOS than what your computer originally came with, or what you were using before the disk was damaged. To learn more about these options, see Recover all your files from a Time Machine backup in the macOS User Guide and the Apple Support article How to reinstall macOS.
Important: Advanced users may want to create a bootable installer to reinstall macOS in the future. This can be useful if you want to use a specific version of macOS. See the Apple Support article How to create a bootable installer for macOS.
Restore factory settings. You can restore your Mac to its original state by erasing your Mac, then using macOS Recovery to reinstall macOS. See Erase your Mac in the macOS User Guide.
Learn more. See Back up your files with Time Machine and Time Machine troubleshooting on Mac in the macOS User Guide. Also see the Apple Support article What to do before you sell, give away, or trade in your Mac.