Jump to content

Bundle (macOS)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Wikievil666 (talk | contribs) at 01:59, 2 September 2010 ("However" meaning 'nonetheless' is superfluous here.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Under NEXTSTEP, Mac OS X and GNUstep, a bundle is a directory (or file) that allows related resources such as software code to be grouped together. They were introduced into the Macintosh world as packages in Mac OS 9 and are similar in concept to the Application Directories used in RISC OS, on the ROX Desktop, as integrative technology into Ubuntu and Debian Linux with SpatialBundle, and on Super OS (RUNZ bundles).

Applications, frameworks, and plugins are most commonly grouped as bundles, although documents can also be grouped as bundles. They are manipulated with the NSBundle class in the NeXT Foundation kit and in Foundation in Cocoa, and with CFBundle under Core Foundation.

A bundle usually contains one file representing executable code, and files that represent resources such as nibs, images, sounds, and other media. On other systems such as Microsoft Windows, these resources are usually included directly in the executable file itself at compile time. On older Macintoshes, a similar technique is used, where additional metadata can be added to a file's resource fork. Beginning with the Mac OS X, the NEXTSTEP concept of bundles was adopted for this purpose. Most types of bundles are used and interacted with as though they were ordinary files on the system in an attempt to reduce accidental tampering. A bundle also aims to ease problems associated with organizing resources by using a simpler structure of hierarchical directories rather than the resource fork.

The Uniform Type Identifier (UTI) for a bundle is com.apple.bundle and for a package is com.apple.package.

Mac OS X application bundles

Application bundles are often presented to users as a single file known as a "package". This file is really a directory ending in a .app extension. Control-clicking (or right-clicking) on the package and selecting "Show Package Contents" allows a user to open up the bundle and see the contents. In an application, the first directory in the bundle is usually Contents. Within Contents there is usually another directory (called MacOS on Macs, or using the application's name on GNUstep), which contains the application's executable code. Within the Contents folder there is usually also a directory called Resources, which contains the resources of the application.

Among other things, the Resources folder contains localized versions of the application's nib files.

Other common subdirectories include Plugins, Frameworks, and Shared Frameworks. The Frameworks directory contains frameworks used by the application, and are used even if another version of the framework exists on the system. The Shared Frameworks directory contains frameworks that can be used both by the application that contains them, and other applications; they are used only if a newer version does not exist elsewhere on the system. Plugins contains extensible code used by the application.

Mac OS X framework bundles

Mac OS X frameworks are also stored as bundles; the top-level directory framework bundles. The dynamically library code for the framework is in a file whose name is the same as the name of the framework, in the top-level directory of the bundle, possibly with a Headers folder containing header files for the framework and other subfolders such as Resources.

Mac OS X loadable bundles

Loadable bundles are bundles which contain code that can be loaded at runtime[1]. Loadable bundles usually have the extension .bundle and are most often used as plug-ins. An example of an application that traditionally supports bundles is Apple Mail[2][3]. On Mac OS X there is a way to load bundles even into applications that don't support them allowing for third party hacks for popular applications such as Safari[4].

Other bundle formats

Other bundles include Rich Text Format documents with images, which carry the .rtfd extension, OS X widgets, and partially downloaded files in Safari, which carry the .download extension. In GarageBand, Keynote, Pages, Numbers, iMovie HD and Xcode the project files are also represented as bundles. NOTE: The new versions of Keynote 4, Pages 3, and Numbers 2 included in iWork '09 now save a document bundle as a compressed flat file by default. To view the contents of an iWork '09 document bundle, change the extension to .zip and decompress the file.[5]

Apple's installer packages (.pkg) are bundles that contain pax archives. See Installer (Mac OS X).

There are many third-party Mac OS X applications which utilize their own custom bundle format (e.g. CandyBar's .iContainer bundles).

The Linux distro Super OS also uses bundles in the RUNZ format.

References

See also