Skip to content

Instantly share code, notes, and snippets.

Created Sep 18, 2020
What would you like to do?
Display TimeMachine logs (acts like tail -f)
#!/usr/bin/env bash
# Usage: [last]
# last: displays up to "last" events before streaming. defaults to 1h (see --last option for log)
ARGS=( --info --predicate 'processImagePath contains "backupd" and subsystem beginswith ""' )
# Implementation note: tr -u and sed -l are required (nothing shown until buffer full otherwise!)
tmlog() {
/usr/bin/log "$@" "${ARGS[@]}" | tr -u -s ' ' | sed -l -n 's/' | cut -d' ' -f 1,2,10-
tmlog show --last $LAST
tmlog stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment