Bundle file (OS X)

An OS X bundle file is actually a directory (folder), but the Mac Finder treats it like a single file. This concept of treating a directory as a file is used commonly in OS X (and iOS) file formats, in preference over the earlier system of using resource forks to attach related items to a file. Various special-purpose "bundles" of this sort exist with a number of different file extensions, such as .app for iOS apps. General-purpose bundles can have a .bundle extension, and some are used in the System and Library directories of OS X. The purpose is to group related files together and treat them as a unit when the user is installing, copying, and moving them, while they remain individually accessible by the programs needing to use them.

Some bundle files have an internal structure with subdirectories within them, while others have a flat structure with all their files in the "root" directory within them.

An application registers a key with the Finder so it can treat the package as a file. "The CFBundleDocumentTypes key stores information about the document types your application supports. For each document package type, include the LSTypeIsPackage key with an appropriate value. The presence of this key tells the Finder and Launch Services to treat directories with the given file extension as a package."

Links

 * Wikipedia article
 * What is a .bundle file and how do I run it?
 * More info on bundle files and how to use them
 * Bundle Programming Guide
 * Common packages: documents which are folders in drag