How to install a DMG file from the command line?

I am looking for a small bash or python script that will install a .dmg file.

We assume that dmg contains one or more .app directories, which must be copied to /Applications , overriding any existing directories.

Files or directories that do not match the *.app pattern should be ignored.

+7
source share
1 answer

You can mount a disk image using

 hdiutil attach -mountpoint <path-to-desired-mountpoint> <filename.dmg> 

The disk image will be mounted on the selected path (the argument following -mountpoint ). Then find the .app file and copy the file to /Applications .

Once you are done installing, unmount the disk image:

 hdiutil detach <path-to-mountpoint> 
+12
source

All Articles