34

When compacting a sparse image with the hdiutil compact command, it fails with the message hdiutil: compact failed – Function not implemented.

1
  • I am getting this same error message, as root, on two different computers. One 10.10 (which created the sparsebundle) and on 10.6.8.
    – user110919
    Commented Jan 24, 2015 at 16:55

2 Answers 2

68

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 
1
  • Boah! Really? Well, that helped.
    – Anticro
    Commented Feb 16, 2022 at 16:04
3

You may need to run the command as root :

sudo hdiutil compact <sparseimage>
4
  • Care to share the down-vote, hidden warrior? Running the command as root worked for me when I experienced the error message.
    – vol7ron
    Commented Dec 22, 2016 at 3:49
  • hidden warrior is probably hidden troll, pay no notice. You are right. Thanks.
    – cucu8
    Commented Aug 6, 2017 at 16:51
  • Thanks, Cucu. I think I was surprised to see it on such an old question/answer. It's possible root is unnecessary. I suppose I could say as the system superuser, since some people don't use the default.
    – vol7ron
    Commented Aug 6, 2017 at 16:55
  • Wanted to add I just had this help fix my issue on the latest Catalina and we're in 2021. So, this answer is still totally relevant.
    – Farley
    Commented Jan 5, 2021 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .