I tried hdiutil info -plist
, but if I shift the DMG file elsewhere after mounting it, it doesn't update the DMG path. If I right click and select 'Get info' on the volume, I'm able to view the correct DMG path.
MacOS – How to get the path to a DMG (disk image) file given the mounted volume path
filesystemmacosmetadata
Related Question
- MacOS – How to get file metadata
- MacOS – Not possible to create a sparsebundle image on a SMB mounted Volume
- MacOS – Can automation service to get the parent folder path
- MacOS – How to get the Disk Image property using terminal
- MacOS – Attach one .dmg file on different computers at the same time (hdiutil attach)
- MacOS – the images for a .pkg / .dmg file located
Best Answer
A somewhat pedestrian way would be to retrieve the name of your DMG file from the output of
hdiutil
and then search for it, e.g., viaYou may need to modify the
grep dmg
part to be smarter if you have several images mounted, or you loop through all DMG files reported byhdiutil
, e.g.,However, none of the above takes your mount path as input. To do that, you could add a
sed
command in the pipe that extracts the paragraph of interest, e.g.,Perhaps it is also easier to work on the direct output of
hdiutil info
, without the-plist
flag.