{"id":240,"date":"2023-11-04T11:25:17","date_gmt":"2023-11-04T11:25:17","guid":{"rendered":"https:\/\/iain.rauch.co.uk\/blog\/?p=240"},"modified":"2023-11-04T11:27:45","modified_gmt":"2023-11-04T11:27:45","slug":"how-to-delete-old-time-machine-backups-on-macos-ventura","status":"publish","type":"post","link":"https:\/\/iain.rauch.co.uk\/blog\/2023-11\/how-to-delete-old-time-machine-backups-on-macos-ventura\/","title":{"rendered":"How to delete old Time Machine backups on macOS Ventura"},"content":{"rendered":"\n<p>Time Machine automatically deletes old backups when it&#8217;s getting full, but if you also use the backup disk for other purposes, you might want to clear some space manually.<\/p>\n<p>There is a built-in command line utility that comes with macOS which you can use for this &#8211; <code>tmutil<\/code>.<\/p>\n<p>Specifically, the sub-command you want is <code>tmutil delete<\/code>, here is an extract from the man page:<\/p>\n<blockquote>\n<pre>     delete [-d backup_mount_point -t timestamp] [-p path]\n             Deletes the backups with the specified timestamp from the backup volume mounted at the specified\n             mountpoint. The -t option followed by a timestamp can be used multiple times to specify multiple backups\n             to delete. For HFS backup disks, a specific path to delete can also be specified using the -p option.\n             This verb can delete items from backups that were not made by, or are not claimed by, the current\n             machine. Requires root and Full Disk Access privileges.\n<\/pre>\n<\/blockquote>\n<p>You can list existing backups with <code>tmutil listbackups<\/code> but the path that&#8217;s printed is <strong>not<\/strong> the path you need to provide to <code>tmutil delete<\/code>. In fact, you actually need to provide the <code>-d<\/code> and <code>-t<\/code> flags, not <code>-p<\/code>.<\/p>\n<p>To find the backup mount point, you can use <code>tmutil destinationinfo<\/code>. Here is an example output:<\/p>\n<blockquote>\n<pre>~ $ tmutil destinationinfo                                                                                     \n====================================================\nName          : Time Machine\nKind          : Local\nMount Point   : \/Volumes\/Time Machine\nID            : F0CBBC01-DEAD-CA1F-BEEF-0000AAAABBBB\n<\/pre>\n<\/blockquote>\n<p>So in this case, the value for the <code>-d<\/code> flag is <code>\"\/Volumes\/Time Machine\"<\/code>.<\/p>\n<p>You can extract this with <code>awk<\/code> or another utility, for example:<\/p>\n<blockquote>\n<pre>~ $ tmutil destinationinfo | awk -F ' : ' '\/Mount Point\/{print $2}'                                            \n\/Volumes\/Time Machine\n<\/pre>\n<\/blockquote>\n<p>As for the <code>-t<\/code> (timestamp) flag, this is obvious from the <code>tmutil listbackups<\/code> output, but you can even specify <code>-t<\/code> in the <code>listbackups<\/code> sub-command which prints only the value needed in the correct format.<\/p>\n<p>For example:<\/p>\n<blockquote>\n<pre>~ $ tmutil listbackups -t\n2022-02-05-094839\n2022-02-12-091416\n2022-02-19-093000\n2022-02-26-092448\n...\n<\/pre>\n<\/blockquote>\n<h2>Bringing it all together<\/h2>\n<p>Now we know what values to pass to <code>tmutil delete<\/code>, the final command might look like this:<\/p>\n<blockquote>\n<pre>sudo tmutil delete -d \"\/Volumes\/Time Machine\" -t 2022-02-05-094839<\/pre>\n<\/blockquote>\n<p>But we can go one better than this&#8230; Say you want to delete all the backups from Jan-Mar in 2023, you can use this one-liner:<\/p>\n<blockquote>\n<pre>tmutil listbackups -t | \\<br \/>  egrep '2023-0[123]' | \\<br \/>  xargs -L 1 sudo tmutil delete \\<br \/>  -d \"$(tmutil destinationinfo | awk -F ' : ' '\/Mount Point\/{print $2}')\" -t<\/pre>\n<\/blockquote>\n<p>Of course you could filter in other ways, e.g. <code>head -n 20<\/code> to delete the oldest 20 backups <em>(careful though, this will delete the most recent as well if there are only 20 or fewer in total)<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time Machine automatically deletes old backups when it&#8217;s getting full, but if you also use the backup disk for other purposes, you might want to clear some space manually. There is a built-in command line utility that comes with macOS &hellip; <a href=\"https:\/\/iain.rauch.co.uk\/blog\/2023-11\/how-to-delete-old-time-machine-backups-on-macos-ventura\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4,15],"tags":[16,26,25],"class_list":["post-240","post","type-post","status-publish","format-standard","hentry","category-apple","category-mac-os-x","category-macos","tag-apple","tag-backup","tag-macos"],"_links":{"self":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":3,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":243,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/240\/revisions\/243"}],"wp:attachment":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}