Application bundle

from Wikipedia, the free encyclopedia

An application bundle under NeXTSTEP and its successors such as macOS or iOS is a package or bundle that is intended for applications under these operating systems . From a technical point of view, this is a folder that must have a certain predetermined structure and a certain file name extension . In this case the filename extension is “app”. The file name of a corresponding application is made up of the name of the application and “.app”.

Under macOS, the Finder , the integrated file explorer and all modules based on the Finder, such as B. file or folder dialogs, an application bundle is primarily treated as a single item or file instead of a folder. When opening this bundle, the contents of a folder are not displayed in the Finder, as is usual with a folder, but a specific file within the bundle is executed. This is located in the “/ Contents / MacOS” folder. Your name depends individually on each application and is specified in the "Info.plist" file.

Using the “Show package contents” action in the context menu , the Finder offers the option of treating the application bundle as a normal folder and displaying it accordingly.

structure

The folder or file structure of an application bundle looks in its minimal form as follows:

Applikations Name.app/
-- Contents/
   -- Info.plist
   -- MacOS/
      -- ExecutableFile

Executable

The "Info.plist" file within the "Contents" folder is essential because it contains information about the application, such as the file name of the file that is displayed when it is opened in the Finder (and accordingly also in other places in macOS ) runs by default. The Info.plist is a normal property list . The corresponding key is "CFBundleExecutable" and contains a string with the file name of the file to be executed relative to the "MacOS" folder in the bundle. In principle, this file can be any file to be executed, provided the system knows how to execute it. The actual program is therefore precisely this file. Running it in the normal way would start the application in the same way, with the difference that when executing a binary file in the "normal" way under macOS , a console is often opened which shows the output of this application . In most cases it will be a binary file, but scripts in Python , Node.js or Ruby can also be displayed there, provided the relevant script is in the "macOS" folder and can be executed and the appropriate runtime is installed.

Optional structure

An application bundle often contains other folders or files within "Contents", such as "Resources", "Frameworks", "PlugIns" or "_CodeSignature". The "Resources" folder, which is available in almost every macOS application, is particularly important because it contains resources for the program. Among other things, the icon file for the application bundle is often used, since the file name of the icon file to be specified in "Info.plist" is relative to the "Resources" folder.

A realistic file structure of an app bundle looks like this:

Applikations Name.app/
-- Contents/
   -- Info.plist
   -- MacOS/
      -- Executable
   -- Resources/
      [...]
   -- Frameworks
   -- _CodeSignature

Resources

The Resources folder usually contains all the data that is important for the end user's application pages, such as pictures, .nip files, .help files, sounds, videos, scripts and much more.

Frameworks

The Frameworks folder contains all macOS frameworks that the application comes with. These are mostly ".framework" files, which in turn are bundles or packages under macOS.

_CodeSignature

Information on certificates and signatures of the application to enable macOS internal authentication of the developer.

functionality

An application bundle is then recognized as such by the finder and treated accordingly if certain criteria are met:

  1. The structure must meet the basic requirements.
  2. The folder must have the filename extension "app".
  3. The "Info.plist" file in the "Contents" folder must contain certain basic information about the app, including: B. the executable, information about the author and some more. If certain information is incomplete or incorrect, the application is considered "Corrupted" when it is opened in the Finder, a corresponding dialog box indicates this.

Icon

The icon shown in the Finder and in the Dock is usually taken from the key "CFBundleIconFile" of the "Info.plist" file. If this is not available, the icon of the folder of the application bundle is used. If this does not exist either, the standard macOS application icon is used.

Info.plist

The property list "Info.plist" is indispensable for the function of an application under macOS. It contains the following important information:

Key function
CFBundleDisplayName Name of the application for the macOS UI
CFBundleExecutable File to be executed when opening
CFBundleIconFile Icon file
CFBundleIdentifier Application identifier
CFBundleName Short name of the application
CFBundlePackageType Type of bundle (APPL)
LSApplicationCategoryType Application category
LSMinimumSystemVersion Minimum required version of macOS

Web links