FG
💻 Software

How can I delete Time Machine files using the commandline

Fresh7 days ago
Mar 15, 202657272 views
Confidence Score1%
1%

Problem

I want to delete some files/directories from my Time Machine Partition using rm, but am unable to do so. I'm pretty sure the problem is related to some sort of access control extended attributes on files in the backup, but do not know how to override/disable them in order to get rm to work. An example of the error I'm getting is: There are a number of reasons I do not want to use either the Time Machine GUI or Finder for this. If possible, I'd like to be able to maintain the extended protection for all other files (I'd like not to disable them globally, unless I can re-enable once I've done my work).

Error Output

% sudo rm -rf Backups.backupdb/MacBook/Latest/MacBook/somedir
rm: Backups.backupdb/MacBook/Latest/MacBook/somedir: Directory not empty
rm: Backups.backupdb/MacBook/Latest/MacBook/somedir/somefile: Operation not permitted

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I delete Time Machine files using the commandline

Low Risk

To work around "operation not permitted" errors, use the Time Machine Safety Net "bypass" program: In 10.8 Mountain Lion, bypass moved into 'Helpers': In 10.10 Yosemite, bypass moved here: Beware when using this to delete specific snapshots: as Time Machine uses hard links, using on folders might also affect older and newer snapshots of the same machine. (See other answers referring to to safely delete a specific snapshot.) Using to delete all snapshots for a single machine is okay though. And …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment