Taking Charge of Time Machine Backups: backing up on demand

Even if your Time Machine backups are running sweetly on auto, there are times when it’s good to be able to make an extra backup, or to stop one which cuts in at an awkward moment.

You might also prefer to take control of the scheduling of backups yourself, either because you want to do something different, or because you can’t run the risk of backups becoming irregular or infrequent (due to the known bug in Sierra’s dispatching).

Stopping Time Machine from making a backup

There are only two ways to prevent a backup from taking place: you can turn Time Machine off, either in its pane or using the command
sudo tmutil disable
and authenticating with your admin password. Once you enable it again, either in its pane or at the command line with
sudo tmutil enable
then backups will resume.

The other way is to cancel a backup once it has started: you can do that using the command in the Time Machine menu, in the Time Machine pane itself, or at the command line using
tmutil stopbackup

There does not appear to be any way of getting Time Machine just to skip the next backup, or to make it half an hour later. It might be feasible to do this if we had access to the dispatching systems CTS and DAS, but as we don’t, that won’t work.

Making a backup now

There are now three ways of getting Time Machine to make a backup at any moment, i.e. now. The simplest is to use that command in the Time Machine menu (there is no equivalent in the Time Machine pane, though). The most flexible is to use the
tmutil startbackup
command in Terminal. This has four options which I discuss below. The third method is to use the button in my free T2M2 utility, available from Downloads above.

As I have shown, automatic Time Machine backups are dispatched using a complex system. They also don’t run the backup tool directly, but work through the backupd-auto system and backupd-helper. Those tools are not user-accessible, but are stashed away in /System/Library/CoreServices/backupd.bundle and set up by the LaunchDaemon named com.apple.backupd-auto.plist.

The user interface to these is the tmutil shell command. Invoked without any options, simply as
tmutil startbackup
it does what the command in the Time Machine menu does: a straight manual backup. Options available to make this ‘smarter’ are:

  • -a or –auto : runs as if an auto backup
  • -b or –block : performs a blocking wait until the backup is complete before exiting the command
  • -r or –rotation : allows automatic rotation of backup destinations
  • -d or –destination : allows you to specify a long UUID for the backup destination; IDs can be revealed using tmutil destinationinfo

At the command line, you can of course tailor the options to precisely what you want. T2M2 uses
tmutil startbackup -a -r
which should behave as closely as possible to a scheduled auto backup, and appears in the log as an auto backup.

None of these methods will affect the timing of the next scheduled backup, which will proceed about an hour after the last one. None of these methods relies on dispatching systems like DAS and CTS, so they should still work even when those dispatching systems are dysfunctional.

Scheduling your own regular backups

As you can run your own single-shot backups using tmutil, it is not difficult to schedule those so that you can supplement automatic backups or replace them completely. This is what third-party Time Machine controls do.

In OS X and macOS, the preferred way of doing this is to make a Property List file which installs your timed backups as a LaunchAgent in either /Library/LaunchAgents or ~/Library/LaunchAgents. If you install into the latter, then your backups will only run when that user is logged in; installing in /Library/LaunchAgents is generally preferred, as your backups will then be run for all users of that Mac.

You can use Lingon to create the Property List file, or write it in another appropriate tool, even a plain text editor. It should have the form
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/sbin</string>
</dict>
<key>Label</key>
<string>co.eclecticlight.backup-timed</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/tmutil</string>
<string>startbackup -a -r</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>

which will run
tmutil startbackup -a -r
every hour.

Although OS X and macOS do still have cron and you could go the traditional Unix route and configure this in your crontab, cron has been deprecated for a very long time in OS X, and in some releases is notoriously unreliable. The LaunchAgent approach is strongly recommended instead.

If you wanted to run tmutil in the background, you could instead install the command in my free utility DispatchRider (from Downloads), but would still need the -a option to run it as if in auto mode.