Last active
May 12, 2022 21:14
-
-
Save mxl/22dc8d5766f5f3c3c7ecdd011c86d107 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BACKUP_PATH=$1 | |
if [ -z "$BACKUP_PATH" ]; then | |
echo "Please provide path to Time Machine backup bundle." | |
exit 1 | |
fi | |
echo "More info at https://jd-powered.net/notes/fixing-your-time-machine-backup/" | |
echo "Don't forget to enable Full Disk Access in System Preferences -> Security & Privacy -> Privacy tab -> Full Disk Access -> check Terminal or iTerm item" | |
chflags -R nouchg "$BACKUP_PATH" | |
VOLUME_ID=$(hdiutil attach -nomount -noverify -noautofsck "$BACKUP_PATH" | grep "Apple_HFS" | awk '{print $1}') | |
fsck_hfs -drfy "$VOLUME_ID" | |
hdiutil detach "$VOLUME_ID" | |
sed -i '' -e '/<key>VerificationState<\/key>/ {' -e 'n; s/<integer>.*<\/integer>/<integer>0<\/integer>/' -e '}' "$BACKUP_PATH/com.apple.TimeMachine.MachineID.plist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment