How do I install a DMG file from the command line?
I am looking for small bash or python script that will install a开发者_开发问答 .dmg
file.
We'll assume that the dmg contains one or more .app
directories that have to be copied to /Applications
, overriding any already existing directories.
Files or directories not matching the *.app
pattern are to be ignored.
You can mount the disk image using
hdiutil attach -mountpoint <path-to-desired-mountpoint> <filename.dmg>
The disk image will be mounted at the selected path (the argument following -mountpoint
). Then, search for an .app
file and copy the file to /Applications
.
Once you have finished installation unmount the disk image:
hdiutil detach <path-to-mountpoint>
精彩评论