title: Making OS X Installer Packages from Mountain Lion to Lion or Snow leopard
body: <p>I'm packaging my Mac app following <a href="https://stackoverflow.com/questions/11487596/making-os-x-installer-packages-like-a-pro-xcode4-developer-id-mountain-lion-re/11487658#11487658">this</a> tutorial.</p>
  
  <p>The packages is generated in two steps:</p>
  
  <ol>
  <li><p>First I generate a temporary package with <code>pkgbuild</code>. It contains just the binaries</p>
  
  <pre><code>pkgbuild --root ${ROOT} --scripts ${SCRIPTS} --identifier myapp \
           --version ${VERSION} --install-location ${INSTALL_DIR} %PKG%
  </code></pre>
  
  <p>where <code>%PKG%</code> is the temporary package file name in <code>Distribution.xml</code>.</p></li>
  <li><p>Then I generate a package with the previous tmp package, a <code>Distribution.xml</code>, background image etc with <code>productbuild</code>:</p>
  
  <pre><code>productbuild --distribution ${DIST_FILE} --package-path ${PKG_PATH} \
               --resources ${RESOURCES} ~/myapp.pkg'
  </code></pre></li>
  </ol>
  
  <p><code>Distribution.xml</code> looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;
  &lt;installer-gui-script minSpecVersion="1"&gt;
      &lt;title&gt;MyApp&lt;/title&gt;
      &lt;options hostArchitectures="x86_64"/&gt;
      &lt;options customize="never" rootVolumeOnly="true"/&gt;
      &lt;welcome file="Welcome.rtf"/&gt;
      &lt;license file="license.rtf"/&gt;
      &lt;background file="background.png" scaling="proportional" alignment="bottomleft"/&gt;
      &lt;os-version min="10.6.6"/&gt;
      &lt;options customize="never" require-scripts="false"/&gt;
      &lt;product id="myapp" version="%VERSION%" /&gt;
      &lt;choices-outline&gt;
          &lt;line choice="default"&gt;
              &lt;line choice="myapp"/&gt;
          &lt;/line&gt;
      &lt;/choices-outline&gt;
      &lt;choice id="default"/&gt;
      &lt;choice id="myapp" visible="false"&gt;
          &lt;pkg-ref id="myapp"/&gt;
      &lt;/choice&gt;
      &lt;pkg-ref id="myapp" version="%VERSION%" onConclusion="none"&gt;%PKG%&lt;/pkg-ref&gt;
  &lt;/installer-gui-script&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>However, the temporary package installation works perfectly well, both on Lion and Snow Leopard. Somehow <code>productbuild</code> is restricting where the app can be installed. I've tried setting  in <code>Distribution.xml</code> but the result is the same.</p>