Skip to content

Instantly share code, notes, and snippets.

@Patronics
Last active October 23, 2022 08:15
Show Gist options
  • Save Patronics/907a7435d637153b46f656f89fe7c4ee to your computer and use it in GitHub Desktop.
Save Patronics/907a7435d637153b46f656f89fe7c4ee to your computer and use it in GitHub Desktop.
Watch detailed Time Machine progress logs
#for watching the logs from an Apple Time Machine backup on MacOS
#the log will update with new progress every 5 minutes
#or get historical records by specifying a durarion of time to look back
RED="$(tput setaf 1)"
YELLOW="$(tput setaf 3)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
if (( $# == 0 )); then
log stream --predicate 'subsystem == "com.apple.TimeMachine"' --info
elif [[ $1 == *-h* ]]; then
echo "usage: ${CYAN}$0 [duration]${WHITE}"
echo "duration specifier such as ${CYAN}20m${WHITE} or ${CYAN}4h${WHITE}"
echo "or ${CYAN}leave duration blank${WHITE} for live data stream"
else
#to see the recent historical records, pass a time specifier
log show --predicate 'subsystem == "com.apple.TimeMachine"' --info --last $1
# choose argument such as 4h to adjust duration to show here ^
fi
#to hide non-progress status messages, adjust the --predicate string to
#--predicate '(subsystem == "com.apple.TimeMachine") && (category == "CopyProgress")'
@Patronics
Copy link
Author

NOTE: this gist has been moved to a dedicated repository, at https://github.com/Patronics/watchTimeMachineLog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment