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'
Click the link to download a disk image (.dmg) file for that macOS. Double-click the .dmg file to open it and see the .pkg file within. Double-click the .pkg file, then follow the onscreen instructions. This installs the macOS installer into your Applications folder.
In Remote Desktop , select a computer list in the sidebar of the main window, select one or more computers, then choose Manage > Install Packages. Select a . pkg or . mpkg file to install.
Double-click the DMG file to open it, and you'll see a Finder window. Often these will include the application itself, some form of arrow, and a shortcut to the Applications folder. Simply drag the application's icon to your Applications folder and you're done: the software is now installed.
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 /
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With