How to delete (with CLI tmutil delete) all old backups from TimeMachine. I wish to keep only current backup.

I wish to put that into crontab.

Found How to Delete Old Backups from Time Machine on Mac

sudo tmutil delete /Volumes/Time Machine Backups/Backups.backupdb/MacBook\ Pro/2015-07-13-150021/

I don't like to specify Timestamps. I wish to have only one current full backup. This means remove deleted files and versions from backup disk.

  • 2
    If you want to do this often I think you are using the wrong tool try Carbon Copy Cloner or Superduper which are designed to just have one copy a – mmmmmm Apr 22 '17 at 9:52
  • 1
    But both cost less(and not a massive amount) than the problems of a bad backup or the time you have spent doing this - but for free look at rsync – mmmmmm Apr 22 '17 at 15:45
latest=$(sudo tmutil latestbackup)
sudo tmutil listbackups | while read backup; do
    if [[ "$backup" != "$latest" ]]; then
        echo sudo tmutil delete "$backup"

Remove the echo once you are sure that the output is correct.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .