Skip to content

Instantly share code, notes, and snippets.

@neilmartin83
Last active September 1, 2021 17:45
Show Gist options
  • Save neilmartin83/5f1b9ec58071243b63e0829d0830b659 to your computer and use it in GitHub Desktop.
Save neilmartin83/5f1b9ec58071243b63e0829d0830b659 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Disables Time Machine and removes all destination set for this Mac
/bin/echo "Stopping Time Machine backup if running..."
/usr/bin/tmutil stopbackup
/bin/echo
/bin/echo "Time Machine Destination(s) Found:"
/usr/bin/tmutil destinationinfo
/bin/echo
/bin/echo "Begin removing destinations..."
destinationids=($(/usr/bin/tmutil destinationinfo | awk -F': ' '/^ID/ {print $2}'))
for id in "${destinationids[@]}"
do
/bin/echo "Removing destination ID: ${id}"
/usr/bin/tmutil removedestination "${id}"
done
/bin/echo
/bin/echo "Disabling Time Machine..."
/usr/bin/tmutil disable
/bin/echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment