How I configure BorgBackup and borgmatic (2023)

https://news.ycombinator.com/rss Hits: 4
Summary

This article outlines how I configure BorgBackup and borgmatic on my machines. macOS Tested on MacBook Air M2 macOS Ventura 13.4.1 borgmatic 1.7.12 (MacPorts) moreutils 0.67_1 (MacPorts) borgmatic and moreutils are also available on Homebrew. Unlike systemd, launchctl doesn’t provide integration a syslog-like service. (I guess Apple expects you to use Console instead) Apple’s unified logging is unreliable and in many tests I have had messages disappearing, even when manually testing with the syslog standard C library function. For example, events disappear for some users when viewing them through log stream. If you want to redirect borgmatic’s standard out and standard error to a $PREFIX/var/log/borgmatic/{stdout,stderr}.log file, I recommend wrapping borgmatic in a helper script like the following, which I have put in $HOME/.local/bin/borgmatic_timestamp.sh: #!/bin/bash # https://apple.stackexchange.com/a/406097 set -e set -o pipefail # Substitute /opt/local/bin/borgmatic and /opt/local/bin/ts # for the correct path if you don't use MacPorts /opt/local/bin/borgmatic create prune -v2 \ 2> >(/opt/local/bin/ts -m '[%Y-%m-%d %H:%M:%S] -' 1>&2) \ 1> >(/opt/local/bin/ts -m '[%Y-%m-%d %H:%M:%S] -') Create a LaunchAgent in $HOME/Library/LaunchAgents/net.yourdomain.yourprogram.plist. Substitute any $USER string for your username: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>net.yourdomain.yourprogram</string> <key>ProgramArguments</key> <array> <string>/Users/$USER/.local/bin/borgmatic_timestamp.sh</string> </array> <key>UserName</key> <string>$USER</string> <key>StartCalendarInterval</key> <dict> <key>Minute</key> <integer>0</integer> </dict> <key>StandardOutPath</key> <string>/Users/$USER/.local/var/log/borgmatic.stdout.log</string> <key>StandardErrorPath</key> <string>/Users/$USER/.local/var/log/borgmatic.stderr.l...

First seen: 2025-08-04 10:24

Last seen: 2025-08-04 13:29