Most of us have come to accept that getting a straight answer for the amount of free space on an APFS volume is tricky. There are snapshots and all sorts of things which make what used to be simple for HFS+ something of a rough estimate. The Finder, the notoriously inaccurate Storage feature in About This Mac, and Disk Utility usually report different figures, sometimes in wild conflict.
But none of these excuses should apply to folders. So when I want to know how much space the Xcode app requires, and how many ‘items’ it contains, surely the answer should be simple and consistent?
Actually, no.
In Big Sur 11.0.1, Finder’s Get Info claims that the size of the Xcode 12.2 app is 28.58 GB, but it only occupies 15.35 GB of disk space. Presumably then many of its components share storage blocks with other files? Of course, as one of its special illusions, maybe the Finder isn’t telling me the whole story for an app, and can’t let me know how many ‘items’ it contains.
Open the app bundle, and Get Info for the Contents folder too. Magically, Xcode has grown in size now to 31.82 GB, occupying 17.4 GB of disk space for its 48,320 items. Yet when I trash a copy of Xcode, as we frequently do when the next release comes racing along, the Trash has to empty hundreds of thousands of items – at the last count, well over 400,000. Let’s go a little deeper to check.
One of Xcode’s biggest folders is Contents/Developer, which is reported with a size of 28.04 GB, only slightly smaller than the whole app, but only taking up 15.11 GB on disk for a tad over 48,000 items. So there surely can’t be much outside this folder?
It’s time for a second opinion, for which I consulted GrandPerspective, which so often seems more reliable than the Finder.
This tells me that Xcode has a size of 15.35 GB, and only takes 14.3 GB on disk, figures which are significantly smaller than any reported by the Finder, even for the Developer folder alone.
Is it really so hard to calculate the size of the contents of a folder on an APFS volume? If not, why can’t the Finder do so reliably? Maybe it’s just guessing.
Conclusion: Xcode 12.2 could be anything from 15.35 to 31.82 GB in size, and could occupy anything from 14.3 to 17.4 GB of disk space. I think I could have guessed better than that.