Making OS X Installer Packages from Mountain Lion to Lion or Snow leopard
Asked Answered
E

1

10

I'm packaging my Mac app following this tutorial.

The packages is generated in two steps:

  1. First I generate a temporary package with pkgbuild. It contains just the binaries

    pkgbuild --root ${ROOT} --scripts ${SCRIPTS} --identifier myapp \
             --version ${VERSION} --install-location ${INSTALL_DIR} %PKG%
    

    where %PKG% is the temporary package file name in Distribution.xml.

  2. Then I generate a package with the previous tmp package, a Distribution.xml, background image etc with productbuild:

    productbuild --distribution ${DIST_FILE} --package-path ${PKG_PATH} \
                 --resources ${RESOURCES} ~/myapp.pkg'
    

Distribution.xml looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <title>MyApp</title>
    <options hostArchitectures="x86_64"/>
    <options customize="never" rootVolumeOnly="true"/>
    <welcome file="Welcome.rtf"/>
    <license file="license.rtf"/>
    <background file="background.png" scaling="proportional" alignment="bottomleft"/>
    <os-version min="10.6.6"/>
    <options customize="never" require-scripts="false"/>
    <product id="myapp" version="%VERSION%" />
    <choices-outline>
        <line choice="default">
            <line choice="myapp"/>
        </line>
    </choices-outline>
    <choice id="default"/>
    <choice id="myapp" visible="false">
        <pkg-ref id="myapp"/>
    </choice>
    <pkg-ref id="myapp" version="%VERSION%" onConclusion="none">%PKG%</pkg-ref>
</installer-gui-script>

The package works fine if it's executed on a machine with same OS version as the one it was created on - Mountain Lion in this case - but it throws a "cannot be installed in this computer" error in a earlier versions; log shows "Installation checks failed." message.

However, the temporary package installation works perfectly well, both on Lion and Snow Leopard. Somehow productbuild is restricting where the app can be installed. I've tried setting in Distribution.xml but the result is the same.

Elyot answered 3/10, 2013 at 10:10 Comment(1)
I also needed to include plugins that worked in PackageMaker - simply add the "--plugins <path>" option to productbuild command.Berty
D
6

The <os-version> element needs to be nested within <allowed-os-versions>:

<allowed-os-versions>
    <os-version min="10.6.6" />
</allowed-os-versions>

You should also set minSpecVersion="2" in <installer-gui-script>.

See Distribution Definition XML Schema Reference.

Disforest answered 14/10, 2013 at 20:47 Comment(3)
Removing <options hostArchitectures="x86_64"/> did the trick. I thought snow leopard was 64 bitsElyot
@hithwen: Snow Leopard is 64 bits, you probably just didn't boot it into the 64 bit mode.Frankenstein
Yes, I found exactly that. Looking at Activity monitor it seems that kernel_task is almost the only process not running in 64 bit, all these years w/o realizing... thanks a lotElyot

© 2022 - 2024 — McMap. All rights reserved.