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.

Community
  • 1
  • 1
hithwen
  • 2,154
  • 28
  • 46
  • 1
    I also needed to include plugins that worked in PackageMaker - simply add the "--plugins " option to productbuild command. – petert Jun 06 '14 at 10:48

1 Answers1

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.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • 3
    Removing did the trick. I thought snow leopard was 64 bits – hithwen Oct 15 '13 at 21:06
  • @hithwen: Snow Leopard *is* 64 bits, [you probably just didn't boot it into the 64 bit mode](http://macperformanceguide.com/SnowLeopard-64bit.html). – Kuba hasn't forgotten Monica Oct 15 '13 at 21:10
  • 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 lot – hithwen Oct 15 '13 at 21:22