Time Machine Cleanup
tm-cleanup.sh is a Zsh script to clean up Time Machine backups and reduce its
tm-cleanup.sh provides two interfaces:
A command-line interface.
An interactive, dialog-based interface.
tm-cleanup.sh requires super-user privileges, so it's normally executed using
tm-cleanup.sh is a Zsh script that lists the completed Time Machine snapshots
and deletes those that satisfy the specified criteria. Two types of deletion
By date: snapshots that are older than a specified number of days are deleted. The default threshold is 30 days.
By number: a maximum number of snapshots is retained and oldest snapshots are deleted.
Only one deletion criteria can be specified.
The syntax of
tm-cleanup.sh is the following:
$ tm-cleanup.sh (-d days | -n number) [-f] [-x] $ tm-cleanup.sh [-h]
-dis specified, backups older than the specified number of days will be deleted.
daysis a positive integer number.
-nspecifies the number of backups to retain.
numberis a positive integer number.
tm-cleanup.shexits and prints an error message if a Time Machine backup is currently in progress.
-fforces the backup deletion concurrently.
-hprints the help message and exits the program.
-xperforms a dry clean: it will print the list of operations that will be performed without actually performing any.
This script never deletes the latest snapshot, no matter the value of the
tm-cleanup.sh also provides an interactive interface which is useful if the
user wishes to pick which backups to delete using a dialog-based interface. The
interactive interface can be launched by passing no arguments to the script:
The interactive interface starts with a menu showing the available operations a user can perform:
The Delete backups operation brings the user to a dialog where the backups to delete can be selected. By default, backups are shown in reverse chronological order (i.e.: latest first) and all except the first are selected.
The backups deletion may take a long time to complete, during which a progress dialog is shown.
At the end of the deletion, a confirmation is shown to the user.
The script prevents users to delete all the backups. If all the backups are selected, an error message is shown.
This package is configured using the GNU Autotools. For this reason, users who just wish to use this software have to download a release tarball. Release tarball are attached to each release. The latest release of this package can always be found using the latest tag.
Once a release tarball has been downloaded and uncompressed, this package can be installed using the following commands:
$ ./configure $ sudo make install
Please, refer to the Autotools documentation if you'd like to customise the installation procedure.
The package can then be uninstalled using the following command:
$ sudo make uninstall
To make path changes visibile in an existing Zsh session, execute the
Since a compatible version of Zsh is bundled with OS X, the command-line
interface of this script has no other requirements. To use the dialog-based
dialog is required.
Bug reports can be sent directly to the authors.
Copyright (C) 2015-2017 Enrico M. Crisostomo
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.