Solution for hdiutil: compact failed – Function not implemented
If you run
$ hdiutil compact my-sparse-image-can-also-be-encrypted.dmg
Initializing…
Finishing…
hdiutil: compact failed – Function not implemented
then this may as well be the case that you are not connected to the power-outlet and running on battery and have not the the needed flag.
If you try -batteryallowed (this means: hdiutil compact my-sparse-image-can-also-be-encrypted.dmg -batteryallowed), then you might be more lucky and it may work. Did for me.
Thank you very much.
I had the same problem when I wanted to shrink my file.sparseimage.
The simple flag “-batteryallowed” saved my day.
Really appreciate your clue.