Hello,
I am trying to create a dmg file by launching hdiutil through my swift program. This swift program is sandboxed.
Here is what i've done:
let hdd_file:String = NSHomeDirectory() + "hdd.dmg.sparseimage"
let process = Process()
process.launchPath = "/usr/bin/hdiutil"
process.arguments = ["create", "-size", "30g", "-fs", "'APFS'", "-volname", "myvolume", "-type", "SPARSE", hdd_file]
let pipe = Pipe()
process.standardOutput = pipe
process.launch()
let data = try pipe.fileHandleForReading.readToEnd()
print(data)
I get this error: hdiutil: create failed - Device not configured
I don't understand why i get this error because the dmg file is created in application's sandbox home directory.
Or maybe hdiutil is forbidden but i am just creating a dmg file. I am not trying to mount a device.
Do you have any idea of how i can create a dmg file from my sandboxed application ?
Thanks