hdiutil: create failed - Resource busy

Trying to run the following from my mac Terminal running on Ventura:


curl -L -o /tmp/vscode.zip

unzip -q -d /tmp/Vscode.app /tmp/vscode.zip


hdiutil create -volname "Vscode" -srcfolder "/tmp/Vscode.app" -ov -format UDZO -imagekey zlib-level=9 -fs HFS+ /tmp/Vscode.dmg


and ending up with this error: hdiutil: create failed - Resource busy


Does anybody know how to go around this?



[Link Edited by Moderator]


Posted on Mar 3, 2023 5:52 AM

Reply
4 replies

Mar 3, 2023 8:19 AM in response to bafmo

bafmo wrote:

My goal is to package the app and upload its .dmg format into Munki. So I do not need to stop after unzipping


If the hdiutil -verbose switch doesn’t show anything useful here (and that switch can be helpful for these cases), and if a restart doesn’t clear this, then you might also want to check with the folks that routinely use Munki, and see if they have any suggestions.


This won’t be the first time somebody has created a local distro for VScode, nor the first time a Munki user has met that error from hdiutil. (And somebody over there has a handy script to create DMGs, too: create-dmg.)


For a previous similar discussion: https://groups.google.com/g/munki-discuss/c/xnWEaGDRlKY/m/Kf9F5UDAAgAJ

Mar 7, 2023 8:12 PM in response to bafmo

I've never tried to do this from the command line, but when creating a .dmg archive of an Apple .app using the Disk Utility GUI, you first need to place the app into another folder before using the Disk Utility GUI to create a .dmg archive from a folder. That way when I mount the .dmg file, the mount point is "/Volumes/Vscode" (in this example) with the "Vscode.app" being the only item showing on that mounted volume.


Perhaps you need to place the "Vscode.app" into its own folder "Vscode" so the app path is:

/tmp/Vscode/Vscode.app


And making the source folder in the hdutil command "/tmp/Vscode".



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

hdiutil: create failed - Resource busy

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.