A sparse bundle image in Mac OS X will grow as you add files to it but never shrink if you remove files inside of it. To reclaim the disk space, you must run the following command :
hdiutil compact path/to/sparsebundle
If your account is protected with FileVault, this is done automatically for you when you logout of your account.
Thanks for that, I’ve looked for this option occasionally but never found it before your post. Just reclaimed 10% of my image size.
Thanks for that – my MacBook Pro ran out of disk space because of my sparsefile – busy shrinking it now thanks to your info!
Great tip. Worked like a charm.
Excellent! Just recovered 75% of a 30GB image, and in about 3 seconds. Thanks!
This worked for me as well, very useful. Note that if you’re on a laptop that is not plugged in, you may get this ridiculously cryptic message:
hdiutil: compact failed - Function not implemented
Adding “-batteryallowed” to the invocation should fix that.