hdiutil: compact failed – Function not implemented
When compacting a sparse image with the hdiutil compact
command, it fails with the message hdiutil: compact failed – Function not implemented.
Solution 1:
The error message is pretty unclear, but one reason might be that you are not connected to the power outlet. Compacting a disk image might be a long and intensive task, and sometimes the OS denies it when you are running on battery to avoid any risk of data loss.
If you are positive that you have enough battery power to complete the task, you may overrun the limitation by adding the -batteryallowed
flag:
hdiutil compact my.sparseimage -batteryallowed
Solution 2:
You may need to run the command as root :
sudo hdiutil compact <sparseimage>