Skip to content

Instantly share code, notes, and snippets.

@smhmic
Created March 6, 2015 03:32
Show Gist options
  • Save smhmic/dce92ffa89dcc59acf26 to your computer and use it in GitHub Desktop.
Save smhmic/dce92ffa89dcc59acf26 to your computer and use it in GitHub Desktop.
Regain direct access to Time Machine backups from old/other computer.
# USAGE: reset_permissions_on_time_machine TIMEMACHINE_HD_NAME OLD_COMPUTER_NAME
function reset_permissions_on_time_machine(){
echo
TIMEMACHINE_HD_NAME="$1"
OLD_COMPUTER_NAME="$2"
if [ -z "$TIMEMACHINE_HD_NAME" ]; then
echo "USAGE: reset_permissions_on_time_machine TIMEMACHINE_HD_NAME OLD_COMPUTER_NAME"
echo "Choose the name of the Time Machine disk:"
ls -1 /Volumes/
echo
return 1
fi
if [ -z "$OLD_COMPUTER_NAME" ]; then
echo "USAGE: reset_permissions_on_time_machine TIMEMACHINE_HD_NAME OLD_COMPUTER_NAME"
echo "Choose the name of the computer's backups to reset:"
ls -1 "/Volumes/$TIMEMACHINE_HD_NAME/Backups.backupdb/"
echo
return 1
fi
echo "sudo chmod -R -N '/Volumes/$TIMEMACHINE_HD_NAME/Backups.backupdb/$OLD_COMPUTER_NAME'"
sudo chmod -R -N "/Volumes/$TIMEMACHINE_HD_NAME/Backups.backupdb/$OLD_COMPUTER_NAME"
#
# TODO: why does this produce a few errors like this: ?
# chmod: Failed to clear ACL on file xxxxxx.jpg: Operation not permitted
#
echo && echo "Complete." && echo
}
reset_permissions_on_time_machine "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment