I wrote a bash script to delete all the backups but the latest since the ones posted elsewhere didn't work for me. I know you didn't want to specifically do that, but it can be modified to keep more backups (see below). Please not that this does not apply to deleting specific folders or files from backups. This script assumes that you have it on a local hard disk (an external disk, most likely). I had to write my own because the backups are not associated with this computer, so tmutil listbackups
doesn't work, and that's what other scripts depended on.
In the scripts below, replace DISKNAME
with the name of the hard disk with the Time Machine backups and COMPUTERNAME
with the name of the computer that the backups belong to.
First, run this script to see a list of the backups the script will delete:
while read line; do
echo "/Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME/${line}"
done < <(ls /Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME | tail -r | tail -n +3)
The +3
will make leave the last backup. If you want to keep the last two backups, make it +4
. To keep the last three backups, +5
, and so on.
To delete all of the backups except the latest, run this script:
while read line; do
sudo tmutil delete "/Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME/${line}"
done < <(ls /Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME | tail -r | tail -n +3)
I know it could be made fancier by defining variables and stuff, but to be honest, I'm not that well-versed in shell scripts. I just know the other super-complicated ones didn't work, but this one did for me, so here it is for posterity.
tmutil compare
and don't have a GUI interface. Most users just put their old drive on a shelf and buy a new 4 TB drive for $129 and start backing up again rather than micromanage backups. There are many tools to help with managing storage, some very inexpensive. Have you explored the control you have with Time Machine? – bmike♦ Mar 25 '13 at 15:02