Note: this is just a draft -- the last time I followed this process was a few years ago, so don't use this guide until I actually give it a test run. ## Create a "disaster recovery" backup of your Mac by making an exact copy of the disk In addition to using something like [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac, I also recommend creating a "disaster recovery" backup by making an exact byte-for-byte copy of the hard drive itself. This is a universal method which can be used with any kind of computer (not just Macs). However, you need to ensure that the hard drive isn't changing (being written to) as you are performing the backup. This means you can't be booted from the hard drive which you are trying to backup. In the old days, this was easy: simply remove the hard drive from the machine, plug it into another machine, and image the drive. That's a bit of a pain with modern Mac laptops. An alternative to removing the hard drive is to boot the mac off of an external drive, such as a [USB flash drive](https://en.wikipedia.org/wiki/USB_flash_drive). However, this means we need a working operating system on the flash drive. ## Create a bootable flash drive A universal way of doing this would be to install something like [Knoppix](https://en.wikipedia.org/wiki/Knoppix) to the flash drive. However, Knoppix may not be compatible with the latest Mac hardware. You can instead use the Mac OS installer application to create an installer which boots and runs from a flash drive. Apple publishes a [guide](https://support.apple.com/en-us/HT201372) for doing just this. The summary is: - Partition and format the USB flash drive as Mac OS Extended. - `sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume` ## Boot from the flash drive Hold the 'option' key while booting, which should present a boot menu. ## Launch a terminal When your Mac boots from the flash drive, it should automatically start the Mac OS installer. From the menu at the top of your screen, there should be an option to open a terminal (which will exit the Mac OS Installer). ## Create the backup Plug in an external USB hard drive onto which you will write the backup file. Run `df -h` to see where your Mac mounted the external drive (e.g. `/Volumes/UNTITLED`). Run `diskutil list` and find the device name which describes the hard drive internal to your Mac (e.g. `/dev/disk0`). Run `dd if=/dev/disk0 bs=1m | gzip --fast > /Volumes/UNTITLED/mybackup.dd.gz` This will use `dd` to read `/dev/disk0` in 1 megabyte chunks (which speeds things up a bit), uses `gzip` to compress the backup image, and writes the backup to a file named `/Volumes/UNTITLED/mybackup.dd.gz` ## Restoring from the backup If you later need to restore from this backup, boot your Mac from the same USB flash drive, open a terminal, plug in your external USB drive, and run `dd if=/Volumes/UNTITLED/mybackup.dd.gz | gunzip > /dev/disk0`. Your Mac should now be restored to the exact state at which you performed the backup.