MacOS – What’s the difference between a package and bundle

filefilesystemmacos

I seemingly see the words package and bundle used interchangeably in Apple documentation referring to a special folder in the file system that the user sees as document (iWork Pages document) or application (Pages.app). I know one can view the contents of a package or bundle by right clicking on one of these special files and clicking Show Package Contents. Which suggests to me that both are are a type of package. So is a bundle a special type of package?

Best Answer

From Apple's Bundle Programming Guide

Although bundles and packages are sometimes referred to interchangeably, they actually represent very distinct concepts:

A package is any directory that the Finder presents to the user as if it were a single file.
A bundle is a directory with a standardized hierarchical structure that holds executable code and the resources used by that code.

Also

The Finder considers a directory to be a package if any of the following conditions are true:

The directory has a known filename extension: .app, .bundle, .framework, .plugin, .kext, and so on.
The directory has an extension that some other application claims represents a package type; see Document Packages.
The directory has its package bit set.

In code with bundles and packages are manipulated by the same NSBundle class