hdiutil: could not access / create failed - Operation canceled
Earlier in the year I wrote a blog post showing how to build a Mac OS X DMG file for a Java application and I recently revisited this script to update it to a new version and ran into a frustrating error message.
I tried to run the following command to create a new DMG file from a source folder...
$ hdiutil create -volname "DemoBench" -size 100m -srcfolder dmg/ -ov -format UDZO pack.temp.dmg
...but was met with the following error message: ~text ...could not access /Volumes/DemoBench/DemoBench.app/Contents/Resources/app/database-agent.jar - Operation canceled hdiutil: create failed - Operation canceled ~
I was initially a bit stumped and thought maybe the flags to hdiutil had changed but a quick look at the man page suggested that wasn’t the issue.
I decided to go back to my pre command line approach for creating a DMG - DiskUtility - and see if I could create it that way. This helped reveal the actual problem:
I increased the volume size to 150 MB... ~text $ hdiutil create -volname "DemoBench" -size 150m -srcfolder dmg/ -ov -format UDZO pack.temp.dmg ~
and all was well: ~text .................................................................................................... .......................................................................... created: /Users/markneedham/projects/neo-technology/quality-tasks/park-bench/database-agent-desktop/target/pack.temp.dmg ~
And this post will serve as documentation to stop it catching me out next time!
About the author
I'm currently working on short form content at ClickHouse. I publish short 5 minute videos showing how to solve data problems on YouTube @LearnDataWithMark. I previously worked on graph analytics at Neo4j, where I also co-authored the O'Reilly Graph Algorithms Book with Amy Hodler.