I'm building an installer using pkgbuild
and productbuild
. I'd like to be able to collect the install logs from my users in the case that anything goes wrong. It'd be nice if those logs were not mixed in with everything else they've installed.
By default it looks like all logs go to /var/logs/install.log
. Is there any way to change this location for my app's installer logs?
I ended up solving this by adding the following function to the end of my postinstall script. It detects the first line of install.log that's relevant to the current installation, and copies everything from that line to the end of install.log into a separate file.
One caveat: if multiple installations are happening simultaneously, it's possible to get logs from the other installation mixed in. This solution simply captures a time-bounded snapshot of install.log, but doesn't separate the logs from multiple installations.