38

I have automatic backup enabled and local TimeMachine snapshots take a large amount of disk space. This space is listed as purgeable in disk info, but cannot be actually used until the system decides to free it up. How can I force TimeMachine to delete those snapshots?

4
  • 1
    Welcome the AskDifferent. While it's perfectly fine to post both the question and the answer, please make sure that the question actually reads like a question, e.g. starts with the problem to be solved, actually contains a question, explains why tmutil thinlocalsnapshots is not what you are looking for etc.
    – nohillside
    Commented Oct 28, 2018 at 12:35
  • The thin command is so directly addressing this need I’ll link to that question in a specific answer to the question of freeing up space “taken” by these. Note, the system purges these automatically so there is no need to free up this space
    – bmike
    Commented Oct 28, 2018 at 19:56
  • 2
    @bmike in my case, I needed to free the space in advance, because a software installer wouldn't let me to run an installation unless there is 50GB of free disk space. I guess thinlocalsnapshots would work as weel.
    – Martin
    Commented Oct 29, 2018 at 8:50
  • 2
    +1 for that reason. I wouldn't expect many installers to check purgeable space and trust that once it started it would free up faster than it wrote. Glad you have a couple options.
    – bmike
    Commented Oct 29, 2018 at 11:39

5 Answers 5

51

In Terminal, execute this small script:

for d in $(tmutil listlocalsnapshotdates | grep "-"); do sudo tmutil deletelocalsnapshots $d; done

The script lists all snaphosts and deletes all of them in a loop.

3
  • 3
    This just freed up 190GB on my machine...
    – bobbyz
    Commented Dec 17, 2020 at 7:32
  • 1
    is there any way to check what is the size of these backups before I delete them?
    – Ajak6
    Commented Mar 24, 2021 at 5:53
  • This just freed up 111GB on my machine, thanks!
    – Joe B
    Commented Sep 1, 2023 at 22:13
11

If you’re not running low on disk space (5 GB free) - just let this space be allocated as there is no downside to waiting to purge files until you need space.

That being said, if you decide to preemptively delete backups, I prefer to tell the system to free up space. If you know you have 50 GB amount to free, change the 5 below to 50 and then the system will iterate across all the local snapshots and prune them in the order defined by the system.

tmutil thinlocalsnapshots / $(echo "5 * 1000000000" | bc) 2

The only iteration I would do is to see how many APFS volumes you have and then perhaps thin any that are mounted.

Here’s a nice thread explaining the urgency - 2 works well for my needs, but the manual page explains there are 4 levels of urgency, so if you have specific needs, watch the IO and performance during thinning and experiment with smaller snapshots to thin.

4
  • 1
    On what basis is 5 GB free the threshold? I'm a photographer who uses, for example 128 GB flash cards. If I fill the card up with a photo session and import into Lightroom. I'll need 128GB plus whatever Lightroom uses for its previews. If OSX automatically purges those snapshots if I can't accommodate my import otherwise, then fine. But if not, I'd rather the snapshots not be there. Is there a way to tell Time Machine how much space to leave? Commented Aug 3, 2020 at 18:11
  • 1
    @VictorEngel It’s almost enough to install most major OS upgrades, so I start there. It’s also not so large it’s massive and so small, it’s negligable. This is purgeable storage, you almost never have to ask for this to be freed in my experience. Maybe a question on your overall situation would be useful. Unless you have a massive drive - it might make sense for you to not put 128 GB on the boot volume in the first place...
    – bmike
    Commented Aug 3, 2020 at 20:46
  • 1
    128 GB these days is not a massive amount. Note that my camera is a Canon 5DS, which has raw files that frequently exceed 80MB each. If I'm going to take photos at an event, I certainly want to process them on a local SSD. This is normal, not an edge case. After processing a set of images, I move them to an external HD (currently 5 TB drive that is 80% full). I mentioned the 128 GB removable media to indicate that this is a normal size for an active unit of data. These cards come in larger capacities, but 128GB is sufficient for me. And then there's video.... PS, my boot volume is 1TB SSD Commented Aug 3, 2020 at 21:34
  • The verb "thinlocalsnapshots" no longer exists, at least in Ventura 13.6.2. :-( Commented Mar 15 at 22:27
8

I found by accident that opening the "Storage administration" windows (Cmd-U) in "System Information" released the local time machine snapshots making the space available.

I do not know if this is an officially supported way.

3
  • I think this worked for me. The snapshot is still there when I tmutil listlocalsnapshots / but the space has been freed up...
    – ttt
    Commented Oct 22, 2019 at 4:49
  • 1
    This also worked for me. I have deleted multiple large files using grandperspective, but there is still a lot of storage eaten by misc files. Opening the "manage" window somehow forces the system to index files and reflect the "correct" free space.
    – Jay Wang
    Commented Jun 12, 2020 at 5:00
  • This also worked for me. I had manually thinned some snapshots using the above advice, but this is what got my system to instantly recognize the amount of free space. Thanks!
    – Joe B
    Commented Dec 17, 2021 at 22:16
3

Step 1:

In Terminal, enter the following command to list all backup snapshots:

tmutil listlocalsnapshots /

You will get a list of all the snapshots in the root directory (/).

Step 2:

Delete each snapshot by entering the following command + date of the corresponding snapshot:

sudo tmutil deletelocalsnapshots <snapshot_date>

Example:

sudo tmutil deletelocalsnapshots 2020-09-26-143409

Bonus Tip:

Remember you can always get help with a command in terminal by entering the root command -h or -help.

Enter tmutil -help to see all the Time Machine Utility commands, and usage instructions.

1

The even more elegant way to delete all snapshots:

for x in $(tmutil listlocalsnapshots /);do
sudo tmutil deletelocalsnapshots $(cut -d '.' -f 4 <<<"$x")
done
3

You must log in to answer this question.

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