Returns an application’s main bundle.


CFBundleRef CFBundleGetMainBundle(void);

Return Value

A CFBundle object representing the application’s main bundle, or NULL if it is not possible to create a bundle. Ownership follows the The Get Rule.


CFBundle creates a main bundle whenever it possibly can, even for unbundled apps. There are a few situations in which it is not possible, so you should check the return value against NULL, but this happens only in exceptional circumstances.

For an explanation of the main bundle, see Locating and Opening Bundles in Bundle Programming Guide.

See Also

Creating and Accessing Bundles


Creates a CFBundle object.


Searches a directory and constructs an array of CFBundle objects from all valid bundles in the specified directory.


Returns an array containing all of the bundles currently open in the application.


Locate a bundle given its program-defined identifier.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software