MacOS – a good replacement for the ‘df’ command that is broken on macOS Mojave

apfsdisk-spacemacosmojavetime-machine

The 'df' has been my tool of choice to investigate how much free space I have on my disk. But with APFS, TimeMachine local snapshots and all that, it has become unreliable.

I.e. after removing a lot of files and folders, thus freeing up 100GB, it is of course not yet freed up as it is still part of TimeMachine's local snapshots (I really wish Apple would return to us the possibility to turn local snapshots off, it plays havoc with your control over storage use and it comes with risks). Commands like tmutil deletelocalsnapshots 2019-11-23-180038 seem not to delete anything, as the local snapshot keeps being listed.

Only Storage of System Information now says there is 100GB extra free space. df still reports the space is not free, so Storage of System Information apparently has access to underlying info that makes it report 'virtual free space'.

Deleting local snapshots doesn't do a thing, it seems:

bash-3.2# tmutil listlocalsnapshotdates
Snapshot dates for all disks:
2019-11-23-180038
2019-11-23-192007
2019-11-23-210050
2019-11-23-220637
2019-11-24-100307
2019-11-24-110637
2019-11-24-122648
2019-11-24-165006
bash-3.2# tmutil deletelocalsnapshots 2019-11-23-180038
Deleted local snapshot '2019-11-23-180038'
bash-3.2# tmutil listlocalsnapshotdates
Snapshot dates for all disks:
2019-11-23-180038
2019-11-23-192007
2019-11-23-210050
2019-11-23-220637
2019-11-24-100307
2019-11-24-110637
2019-11-24-122648
2019-11-24-165006

To be honest, I just want to be able to simply free up space and really have it freed up, not linger around in local snapshots. Is that at all possible? Why does Apple makes this simple task so incredibly hard?

Best Answer

The new command to purge snapshots is seriously faster and more well engineered than the previous local store.

It does require a new syntax, so you’re correct, Apple has forced us to learn more and change.

Joshua was in your situation as well and has a very detailed explanation:

Apple tools take a while to classify what’s purgeable, but that is getting better.

If you don’t see immediate clearing of space, it’s a sign your disk has accounting issues and you need to boot to internet recovery or plain recovery on an external drive and repair the wrapper and container.