title: Mac installer package - how to run scripts as root or admin? (postflight)
body: <p>I have created the Mac Package in order to install some of my stuff. I have the postflight script that is supposed to copy over some data to /Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/Stationery/Contents/Resources/ - and for reasons mentioned in here: <a href="https://stackoverflow.com/questions/7116078/how-can-i-build-a-mac-package-on-linux-bom-file-problem">How can I build a Mac package on linux? (BOM file problem)</a> it needs to be postflight script.</p>
  
  <p>However it did not work (it was just downloading a zip file, unpacking it and cp to mentioned location). So I've checked the errors by adding 2> to cp and here's what happened:</p>
  
  <p>cp: /Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/Stationery/Contents/Resources/: Permission denied</p>
  
  <p>I've double check my Info.plist and looks like proper setting is preserved:</p>
  
  <pre><code>&lt;key&gt;IFPkgFlagAuthorizationAction&lt;/key&gt;
  &lt;string&gt;RootAuthorization&lt;/string&gt;
  </code></pre>
  
  <p>But the script still don't have permissions. I've tried the "whoami" and it returned currently logged in user. What's more curious, the installer ia actually asking for admin authentication. You guys have any ideas what should I do to have this script running as root/admin/whoever with greater permissions?</p>