Install dmg package on MAC OS from Terminal
29,004
Solution 1
Try this:
MOUNTDIR=$(echo `hdiutil mount jdk-7u51-macos-x64.dmg | tail -1 \
| awk '{$1=$2=""; print $0}'` | xargs -0 echo) \
&& sudo installer -pkg "${MOUNTDIR}/"*.pkg -target /
Solution 2
Let dmgFilePath
be the variable containing the path of your dmg
file.
Then you can try this :
$ MOUNTDEV=$(hdiutil mount $dmgFilePath | awk '/dev.disk/{print$1}')
$ MOUNTDIR="$(mount | grep $MOUNTDEV | awk '{$1=$2="";sub(" [(].*","");sub("^ ","");print}')"
$ sudo installer -pkg "${MOUNTDIR}/"*.pkg -target /
$ hdiutil unmount "$MOUNTDIR"
Tested on macOS High Sierra even if "$MOUNTDIR"
contains one space.
Author by
user3472065
Updated on August 01, 2022Comments
-
user3472065 almost 2 years
I would like to install the dmg java package in my MAC OS through the terminal
I tried using this command:
sudo installer -package jdk-7u51-macos-x64.dmg -target /
But I receive this error:
installer: Error the package path specified was invalid: 'jdk-7u51-macos-x64.dmg'