Delete Time Machine backups from the command line

Apr 05, '13 07:30:00AM

Contributed by: kirkmc

You may know that you can enter Time Machine through the GUI and delete a backup. In some cases, under Mountain Lion, this results in an error, with a message saying "The operation can't be completed because backup items can't be modified."

In some cases, deleting backups from the Finder won't work; you also may not be able to use the rm command to delete these backups, because they are handled in a special way. Finally, even if all goes well, you may want to delete backups on a remote Mac's Time Machine disk.

There is an executable accessible from the command line that lets you delete these backups. To use this with Mountain Lion, run the following command:

sudo /System/Library/Extensions/TMSafetyNet.kext/Helpers/bypass rm -rfv /Volumes/[disk]/Backups.backupdb/[path]

This command works with Lion:

sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/MacOS/bypass rm -rfv /Volumes/[disk]/Backups.backupdb/[path]

Terminal will display a list of the files as they are deleted.

Found on Stack Exchange. Note that I haven't tested this with Lion.

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20130403003005912