Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 408
hithwen Avatar asked Oct 03 '13 10:10

hithwen


1 Answers

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.

like image 141
Kuba hasn't forgotten Monica Avatar answered Oct 01 '22 18:10

Kuba hasn't forgotten Monica