Launch Services uses a series of prioritized binding criteria to determine the preferred application for opening a given document or URL. These are used by the Launch Services functions that open a document file (LSOpenFSRef, LSOpenFromRefSpec) or a URL (LSOpenCFURLRef, LSOpenFromURLSpec), as well as by those that merely locate the preferred application for such an item without actually opening it (LSGetApplicationForItem, LSGetApplicationForURL). They are also used by the LSGetApplicationForInfo function, which locates the preferred application for opening a family of items defined by specified identifying characteristics.
Preferred Application for a Document
Preferred Application for a URL
For individual document files (whether specified by a file-system reference or a URL with scheme file), the criteria are as follows:
If the user has specified an explicit binding for the document (or for the entire document type to which it belongs), the preferred application is the one the user has specified.
If the document has a filename extension (or if one has been specified as a parameter to LSGetApplicationForInfo), find all applications in the Launch Services database that claim to accept documents with that extension.
If the document carries a four-character file type (or if one has been specified as a parameter), find all applications that claim to accept files of that type.
If more than one application has been found as a result of steps 2–3, apply the following criteria in the order shown:
If the document carries a four-character creator signature (or if one has been specified as a parameter), give preference to any application that claims to accept documents with that signature (typically the application to which the signature belongs).
Give preference to native OS X applications over those that run in the Classic emulation environment.
Give preference to applications residing on the boot volume over those residing on other file-system volumes.
Give preference to applications residing on a local volume over those residing on a remote volume.
If two or more versions of the same application have been found, give preference to the one with the latest version number.
If two or more candidate applications remain after all of the foregoing criteria have been applied, Launch Services chooses one of the remaining applications in an unspecified manner.
Note: Criteria 4c and 4d do not apply in Mac OS X version 10.2 and earlier. Apple reserves the right to change the selection criteria in future system releases.
Note: When the item to be opened is a file-system folder, it is treated as a document file whose preferred application is the Finder. This provides a convenient way of asking the Finder to open a window displaying the contents of a designated folder.
The criteria for URLs with schemes other than file are similar to those for document files, except that the search is based on the URL’s scheme rather than on file characteristics such as the creator signature, filename extension, and file type:
If the user has specified an explicit binding for the URL (or for the entire URL type to which it belongs), the preferred application is the one the user has specified.
If no explicit binding has been specified, find all applications in the Launch Services database that claim to accept URLs with the given scheme.
If more than one application has been found in step 2, apply the following criteria in the order shown:
Give preference to native OS X applications over those that run in the Classic emulation environment.
Give preference to applications residing on the boot volume over those residing on other file-system volumes.
Give preference to applications residing on a local volume over those residing on a remote volume.
If two or more versions of the same application have been found, give preference to the one with the latest version number.
If two or more candidate applications remain after all of the foregoing criteria have been applied, Launch Services chooses one of the remaining applications in an unspecified manner.
Note: Criteria 3b and 3c do not apply in Mac OS X version 10.2 and earlier. Apple reserves the right to change the selection criteria in future system releases.
Last updated: 2007-08-23