Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Delete Time Machine backups from the command line System
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.
    •    
  • Currently 2.15 / 5
  You rated: 5 / 5 (13 votes cast)
 
[17,044 views]  

Delete Time Machine backups from the command line | 7 comments | Create New Account
Click here to return to the 'Delete Time Machine backups from the command line ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: Delete Time Machine backups from the command line
Authored by: harleyb on Apr 05, '13 07:43:43AM

As far as I know, this is not the preferred way to delete Time Machine backups; ideally one would use the tmutil command line program like so: http://phaq.phunsites.net/2011/12/10/deleting-old-timemachine-backups/

If you experience permissions/access problems using that method, then by all means try the "bypass" method in this hint, but it wouldn't be my first choice.



[ Reply to This | # ]
Re: Delete Time Machine backups from the command line
Authored by: Lri on Apr 05, '13 06:24:21PM

tmutil delete only allows deleting complete snapshots and not individual files or folders.



[ Reply to This | # ]
Delete Time Machine backups from the command line
Authored by: benwiggy on Apr 05, '13 09:52:22AM

Hmmm.

"Bypass". "SafetyNet". "rm".

No, I can't foresee any problems there!



[ Reply to This | # ]
Delete Time Machine backups from the command line
Authored by: jaydisc on Apr 05, '13 04:52:46PM

I've found that one way to bypass the protections is to simply rename the Backups.backupd folder to something else. Make your charges. Rename it back.

As far as deleting old backups, this can be done from the Finder, and simply requires admin authentication.



[ Reply to This | # ]
Delete Time Machine backups from the command line
Authored by: benwiggy on Apr 06, '13 09:43:50AM

Using the Finder (or the Terminal) to slash away at files is not a great idea and may cause damage to your backup data.



[ Reply to This | # ]
Delete Time Machine backups from the command line
Authored by: jaydisc on Apr 06, '13 05:52:30PM

Actually, it's using the Finder that's safe as it prevents you from doing anything you shouldn't. Due to the nature of hard links, there's no problem deleting an entire snapshot, which is the only thing that the Finder will let you do.

The only reason I ever had to rename Backups.backupd is that for each snapshot, the capacity (not the usage) is stored in the metadata of the volume's backup folder (check it out with xattr). When you try to restore that snapshot to a smaller volume (regardless of whether the contents fit or not), you are blocked. I had to alter that metadata once, and was only able to do it by renaming Backups.backupd, and then successfully restored that backup to a smaller drive.



[ Reply to This | # ]
Delete Time Machine backups from the command line
Authored by: dfbills on Jan 16, '14 06:40:29PM

This worked great for me under Mavericks 10.9.1 on 01.16.14.

---
-d



[ Reply to This | # ]