Automating Apple Time Machine Backups

Apple's Time Machine was failing to execute daily backups, and, in looking for solutions I discovered this is a known issue. So I started looking for ways to automate backups using KBM. Turns out KBM can't control Time Machine directly, and there are no documented Apple Scripts for controlling Time Machine, but there's a Terminal command that allows users to start a TM backup – "tmutil startbackup"

So I built a macro to run Time machine at 2:30 AM every night.

The Trigger is Time of Day, set to every day at 2:30 AM.
I'm assuming the computer will be asleep then, so the first command is

  1. Wake Screen

  2. Pause for 15 seconds, which should be enough for the computer to wake itself up.

  3. Activate Terminal

  4. Another pause of 1 second.

  5. Insert Text "tmutil start backup" [Return] by Typing to Terminal.

  6. One more pause of 5 seconds, and finally

  7. Quit Terminal.

Ran it last night and it worked a treat.

Would you be willing to share your macro? I'm guessing that your Mac isn't asleep, but that the screen saver is on (which is different.) The KM Engine cannot run when the Mac is asleep, as stated in here:

There are ways to wake up a sleeping Mac using macOS commands, which can even be activated using KM actions, but that doesn't sound like what you are doing here.

Here's a screenshot. I don't know how to share the macro directly from KBM to an existing topic, so sorry for any inconvenience.

Also, here are some details about my system:
Mac Mini 2018
3.2 GHz Intel i7
macOS 13.6.7

And my settings for Energy Saver are as follows:
Enable Power Nap = On
Put hard disks to sleep when possible = Off
Wake for network access = On
Start up automatically after a power failure = Off

You can see that I originally tried to use a Shell Script, but it didn't work, so I disabled the Execute Shell Script command resorted to using the Terminal instead.

Hi, @AudiobookPaul. On a related note, if you want to work with Time Machine interactively, you might find this macro interesting: Time Machine Assistant

1 Like

You can use the same command as in Terminal -- although, to be safe, I've included the full path to tmutil:

Make TM Backup at 04:30.kmmacros (2.1 KB)

1 Like