'How to get the installer path/name from the MAC UI installer(.pkg) start page
We are trying to fetch installer path/name from the MAC UI installer before displaying the Custom nib file.
Below are the options tried:
hdiutil info -plist- Getting the environment variable
$PACKAGE_PATH - Scanning the current directory
ps -eaffor listing the installer process name.
Solution 1:[1]
I needed to perform the same task today and the best approach I've discovered is to tail or cat the /var/log/install.log file just after the pkg is launched & grep for ".pkg".
tail /var/log/install.log | grep ".pkg"
This prints the path & name of the most recently launched pkg file. From there, I can parse the line of the last occurrence to extract my own installer's path & name:
2022-04-21 12:50:01-04 mbp Installer[29570]: Opened from: /Users/[myuser]/Downloads/[myPkgFile].pkg
2022-04-21 12:50:01-04 mbp Installer[29570]: Product archive /Users/[myuser]/Downloads/[myPkgFile].pkg trustLevel=350
Note: So far, I've only tested this on Big Sur 11.6. The log syntax may differ on older or newer versions. I expect, though, that it hasn't changed much over the years.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Will |
