Back up and restore your Mac
To keep your files safe, it’s important to back up your iMac regularly. The easiest way to back up is to use Time Machine—which is built into your iMac—with an external storage device connected to your iMac. Time Machine can also back up your Mac contents to supported network volumes. For a list of devices supported by Time Machine, see the Apple Support article
Learn more. See Back up your files with Time Machine in the macOS User Guide.