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

1

8

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?

Endocardium answered 28/5, 2019 at 20:40 Comment(0)
E
13

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"/>
Endocardium answered 3/7, 2019 at 15:23 Comment(2)
i used this but my installer section like introduction,summary etc are all black which are not clear due to this image.Bechuana
No problems with that for me. Send me your Distribution.xml or share a linkEndocardium

© 2022 - 2024 — McMap. All rights reserved.