Difference between du and Finder file sizes

filefilesystemfinderspacesparsebundle

I was having a look at the size of libBLAS.dylib at some location in my Mac and du showed it's file size as 572K while the allocated file size (showed by Finder) was 1.4MB. I've read that the lack of sparse files on HFS+ can cause this discrepancy.

My question is that why would a compiled shared library need to be sparse – after all, it's not like anything is going to be modifying it.

Best Answer

Difference is in units they use.

du uses BLOCKSIZE=4096 bytes by default (rounded if Human Readable format option -h i.e. df -h) Finder uses BLOCKSIZE=1000 by default

$du -h /usr/lib/libblas.dylib 
4.0K    /usr/lib/libblas.dylib

and same in Finder.