Every bug report is invaluable, and the most treasured of them all are followed by the user explaining exactly what went wrong, and how you can fix it.
Spundle is a simple utility which puts a more friendly interface on the
hdiutl command tool’s features for working with sparse bundles. It has proved amazingly popular, given that it’s small and single-purpose. Like most of my apps, I wrote it in response to user demand and my own laziness in not wanting to resort to Terminal. But sometimes it returns errors, and working out why can be tricky.
So when Bruce told me that he’d been able to compact sparse bundles on his Intel Mac, but received an “Error 1” on his M1 Mac, I burbled vague things about permissions and Full Disk Access. After all, 1 is one of the most frequent error codes in macOS, and is generally taken to mean that the operation you attempted isn’t permitted. It’s documented in
man hdiutil: ‘”operation not permitted” tends to refer to an operation that cannot be performed, often due to an incorrect effective user ID’.
Bruce did his own detective work though, and got back to me with a solution, that this was because the compaction was being attempted when the Mac was on battery power. Although it’s clearly documented in
man hdiutil, you too may not be aware of this unusual limitation. As the man page explains:
“SPARSE images could be damaged if power is lost during a compact operation. The default is not allowed.” But there is the option of
-batteryallowed to override this behaviour.
So, thanks to Bruce not being fobbed off with my feeble excuses, here’s a new version of Spundle to address this problem.
By default, when you open Spundle, its new checkbox Battery is unticked. If you try compacting a sparse bundle on your notebook when it’s running on battery, you’ll see the error reported, and Spundle’s advice to either connect the notebook to mains power, or tick the box, and try again.
Sure enough, with the Battery box ticked, Spundle now takes your sparse bundle’s life into its hands and compacts it regardless.
Although perhaps a bit of an edge case, I hope this restores your confidence that reporting bugs is invaluable, and that telling me how to fix them is treasured above all.
If you do still use
hdiutil, I hope Bruce’s tip proves equally valuable.