When trying to convert or resize a dmg image I get the error:
hdiutil: convert failed Resource Temporarily Unavailable error
or
hdiutil: resize: failed. Resource temporarily unavailable (35).
(hdiutil error code 35).
The problem appears to happen when you unmount the image using umount
.
Remount the image (either using hdiutil attach
or just double click the image) and use the command hdiutil detach
it again. This will unmount and eject the image.
hdiutil detach /Volumes/<your image>
In my case something was trying to access the image. What finally worked:
sudo lsof | grep ~/Unix.sparsebundle/
sudo kill -9 889
hdiutil resize -size 100g ~/Unix.sparsebundle/
Another possibility is that the disk image is still mounted (from previous work on it). In this case, just select the eject icon.
Afterwards, the hdiutil convert worked great.
If you are accessing a disk image over a network then it's possible to have various operations interrupted if you encounter any kind of network issue, which can result in the image becoming "temporarily unavailable" when you try to resume whatever you were doing.
This happens because only a single system can have a disk image mounted at once, otherwise corruption could/will occur, but the locking mechanism for preventing double-access can end up being left in an inconsistent state, so even if you only have a single system accessing an image, you can end up with this error, as hdiutil
thinks the image is already open on another system.
As others have pointed out, a restart can resolve this; I'm not actually sure why, as I'm not clear on how hdiutil
/macOS marks an image as in-use. For a sparse bundle this has something to do with the token
file, and there's a handy workaround if you don't want to have to restart.
NOTE: You must be absolutely certain that yours is the only system accessing this disk image, fiddling with the token
file while an image is already mounted could destroy your image completely! Always have backups wherever possible, and be very careful at all times.
cd
(with trailing space) then drag your sparse bundle file onto the Terminal window, hit enter)mv token{,.old}
)cp token{.old,}
)chown 'user:group' token
, with the correct user/group, it should match the user:group of the Info.plist
file in the same folder.After copying the token in this way, you should now be able to use hdiutil attach /path/to/image
as normal to attach and mount the image.
NOTE: Be very careful using this method; I move the original out of the way rather than discarding it, so that it is always possible to recover it if anything goes wrong.
ls -l Info.plist
while cd
'd into the sparsebundle should do the trick. In general you should just need it to match whichever user your system would be running as while accessing the image.
What worked for me when trying to create macOS install iso:
hdiutil attach
to the subfolder of the new folderhdiutil detach
yarn build
to kick off electron-builder
in a vite-electron app. Added the release
directory to the Privacy list and voila. Surprising fix but very thankful!
Sometimes you can't explain whats going on. For my case, the error message was that they could not read my dmg file created with createinstallmedia
. After reboot, i noticed that the process had been mounting some temporary file. I had been following these steps: How to Create a Bootable macOS Big Sur ISO
restart your machine and it run it again it should work.