PSA: Use -y with embedded frameworks and command-line zip
In an effort to inject some metrics into the ongoing .dmg vs. .zip wars, Peter Hosey recently put up a comparison of different compression options for application deployment on MacOS X. The most interesting thing he noticed was just how poorly command-line zip does compared to the Finder's "Make archive of" zip.
The solution, as pointed out by Fritz Anderson on darwin-dev, is to make sure to pass the -y option to zip. By default, zip will follow symbolic links and include their content in the zip file. Since frameworks in MacOS X contain symbolic links to internal structures to help with versioning (i.e. Headers -> Versions/Current/Headers) you'll end up up with three copies of everything in zipped framework created with 'zip -r9'. The -y flag tells zip to preserve symbolic links, which can significantly reduce file size if you use embedded frameworks in your app. This won't work on non-UNIX systems, but for Mac application deployment this is not a problem. (There's also a correctness issue here — some day the system might rely on Headers being a symbolic link.)
zip is still has the worst compression of the options available, but at least now it is in the same ballpark.
Paul Kim pointed out on #macsb that Finder uses ditto to make its archives. The correct incantation appears to be ditto -kc --keepParent source destination This will create a zip and it handles resource forks for you.