I want to write a C++ program that spawns off a thread to execute a .dmg file and monitor its completion (success/fail) on Snow Leopard. Would this be as trivial as fork/exec a shell script on Linux? Would I need a 3rd party C++ library to interface .dmg files?
+1
A:
A .dmg file on OS X is a container for an image of a volume or single file system so it's not clear what you mean by execute a .dmg file. If you mean mount the file systems contained in the .dmg file, the easiest way to do that is with the hdiutil command:
hdiutil attach /path/to/file.dmg
If you need to parse the information about the file systems mounted, use the -plist
argument which will return that information in OS X plist
format via stdout.
Ned Deily
2009-12-29 22:08:26
Sorry, my first time developing on Mac. Our Mac installation package is a .dmg file, so I'm treating it like a .msi file, which is apparently fallacious.So I'm guessing I need to mount the .dmg file first and then run the installer inside?
theactiveactor
2009-12-29 22:54:36
Correct, if there is an installer. Apple recommends to avoid using installers, if possible. If the product is a stand-alone .app, you can just ship the app on the dmg and users just copy it to their hard disk (usually to /Applications) with the Finder. hdiutil can also be used to create .dmg files, btw.
Ned Deily
2009-12-29 23:00:05