Time Machine once a day
We got a bit annoyed with the NAS being busy all day with various backups. And whenever two or three Macs do their Time Machine backups at the same time, the performance of the NAS goes way down with all the seeking of the hard disks.
Let's change Time Machine to run less often. As you may know Apple doesn't allow much configuration there for the backup interval and you can't change the system launch agent. But we can disable Time Machine in system preferences and make our own launch agent.
First you make a new text file (e.g. with BBEdit) with this content:
<?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>Label</key>
<string>com.monkeybreadsoftware.runbackup</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/tmutil</string>
<string>startbackup</string>
<string>--auto</string>
<string>--rotation</string>
</array>
<key>StartInterval</key>
<integer>43200</integer>
<key>StandardOutPath</key>
<string>/tmp/runbackup.output.log</string>
<key>StandardErrorPath</key>
<string>/tmp/runbackup.error.log</string>
</dict>
</plist>
You may adjust the label above to your own domain style name (or just keep it as it is). As you see the we run tmutil command here to start backup. The interval is set to 43200, which is 12 hours. But this can be adjusted as needed.
We specify some files for output from the tool, but those are usually empty. By the file date we see in Finder for those files show us the last time the tool started.
Next you save this text above as a file with plist file extension, e.g. RunBackup.plist. Store the file inside the ~/Library/LaunchAgents folder of your user account. If the folder doesn't exist, please create it.
Open Terminal application in Utilities folder. You may run this command:
launchctl manageruid
This prints the user id number. Just copy and paste the text between quotes into the terminal window and press return key to execute.
You install it with the next command here:
launchctl bootstrap gui/501 /~/Library/LaunchAgents/RunBackup.plist
Please adjust the number 501 to what number you have. This command should install the launch agent. You can check if it shows up in the list with the next command:
launchctl list
If you like, you can print information about it:
launchctl print gui/501/com.monkeybreadsoftware.runbackup
This shows various things about the agent including the number of runs. If you adjusted the label above, please adjust the commands, too.
If you like to trigger this right away, you can run this command:
launchctl kickstart gui/501/com.monkeybreadsoftware.runbackup
That should run it right away.
As with many such tips & tricks, I write them down in the blog to find it again in a few years when I google for this. But I hope this helps a few of my readers here.
PS: Since macOS Ventura has a this built-in, you don't need this any more.