macosmacos-mojaveproductbuild

How to set background image in MacOS Mojave pkg installer using productbuild?


I'm using productbuild to create a .pkg installer for MacOS Mojave. I've read the schema reference for the Distribution.xml file. I am successfully using this to include a custom welcome. Therefore I know my resource path is being used correctly when I run:

productbuild --resources ./res --sign "$PKG_SIGN_ID" --distribution Distribution.xml foo.pkg

But I can't seem to create a custom background image. I've tried various jpg and png images.

I have read this question and answer and I've tried with and without a en.lproj subdirectory within my resources directory.

My Distribution.xml ends up looking like this:

<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
<background file="background.jpg" mime-type="image/jpeg" scaling="tofit"/>
<welcome file="welcome.html"/>
<title>My App</title>
    <pkg-ref id="com.foo.myapp"/>
    <options customize="never" require-scripts="false"/>
    <choices-outline>
        <line choice="default">
            <line choice="com.foo.myapp"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="com.foo.myapp" visible="false">
        <pkg-ref id="com.foo.myapp"/>
    </choice>
    <pkg-ref id="com.foo.myapp" version="1.0" onConclusion="none">foo.pkg</pkg-ref>
</installer-gui-script>

Is this no longer possible to do with Mojave?


Solution

  • I found the issue. My problem was I was running in "Dark Mode".

    If you want to set the background image of an installer for DarkMode you need to use the tag background-darkAqua otherwise it will never show:

    <background-darkAqua file="background.png" mime-type="image/png" scaling="tofit"/>