Taken from this link https://developer.apple.com/forums/thread/128166


ZIP

  1. Create a directory that holds everything you want to distribute.
  2. Run the ditto as shown below, where DDD is the path to the directory from step 1 and ZZZ is the path where ditto creates the zip archive.
  3. % ditto -c -k --keepParent DDD ZZZ


PKG

Use the productbuild tool to create a simple installer package for a single app:

% productbuild --sign III --component AAA /Applications PPP

In this example:

  • III is either your Mac Installer Distribution or Developer ID Installer signing identity, depending on your distribution channel. This will typically be named 3rd Party Mac Developer Installer: TTT or Developer ID Installer: TTT, where TTT identifies your team.

  • AAA is the path to your app.

  • PPP is the path where productbuild creates the installer package.


DMG

  1. Use the hdiutil tool to create a disk image for distribution:
  2. Create a directory to act as the source for the root directory of your disk image’s volume.
  3. Populate that directory with the items you want to distribute.
  4. Use hdiutil command shown below to create the disk image, where SSS is the directory from step 1 and DDD is the path where hdiutil creates the disk image.
  5. Use codesign command shown below to sign the disk image, where III is your Developer ID Application signing identity (typically named Developer ID Application: TTT, where TTT identifies your team), BBB is a pseudo bundle ID as discussed in Basic Signing, and DDD is the path to the disk image from step 3.
  6. % hdiutil create -srcFolder SSS -o DDD