Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install a DMG file from the command line?

Tags:

python

bash

macos

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.

like image 732
sorin Avatar asked Jun 15 '11 12:06

sorin


1 Answers

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>
like image 105
nimrodm Avatar answered Nov 05 '22 16:11

nimrodm