Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I want to install a dmg file on a remote server. All I have is an ssh access. Since a DMG is a disk image, I tried to mount it, but mount does not seem to recognize its format.

file says my dmg file is a VAX COFF executable.


First, mount the dmg image : sudo hdiutil attach <image>.dmg

The image will be mounted to /Volumes/<image>. Mine contained a package which i installed with: sudo installer -package /Volumes/<image>/<image>.pkg -target /

Finally unmount the image: sudo hdiutil detach /Volumes/<image>.


You should be able to mount the .dmg using:

hdiutil attach /path/to/file.dmg

And then copy its contents (which appears in /Volumes) where ever you like.


I had to mount and copy the .app to /Applications folder. For Etcher.app:

First as @trojanfoe said :

sudo hdiutil attach /Users/janatac/Etcher-1.2.1.dmg

Then

sudo cp -R /Volumes/Etcher\ 1.2.1/Etcher.app /Applications

You then have your application in /Applications folder

Don't forget to unmount the volume :

sudo hdiutil unmount /Volumes/Etcher\ 1.2.1/

Got it working after reading instructions from a blog post.