Shrinking sparse bundle images

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.

5 thoughts on “Shrinking sparse bundle images

  1. John Warlow

    Thanks for that – my MacBook Pro ran out of disk space because of my sparsefile – busy shrinking it now thanks to your info!

  2. johndburger

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.