Uniform Type Identifier
A Uniform Type Identifier (UTI) is a text string used on software provided by
UTIs use a
Background
One of the difficulties in maintaining a user-accessible
Beginning with
In addition, the
Other file identification types exist: for example, MIME types are used for identifying data that is transferred over the web. However, Apple's UTI system was designed to create a flexible file association system that would describe data hierarchically and allow for better categorization and searching, standardize data descriptions across contexts, and provide a uniform method of expanding data types. For instance, the public.jpeg and public.png UTIs inherit from the public.image UTI, allowing users to search narrowly for JPEG images or PNG images or broadly for any kind of image merely by changing the specificity of the UTI used in the search. Further, application developers who design new data types can easily extend the UTIs available. For example, a new image format developed by a company may have a UTI of com.company.proprietary-image and be specified to inherit from the public.image type.
Apple's macOS continues to support other forms of file association, and contains utilities for translating between them, but will use UTIs by preference where available.
UTI structure
Apple maintains the public.* domain as a set base data types for all UTIs. Other UTIs are associated with these base UTIs by conformance, a system similar to class inheritance. UTIs that conform to other UTIs share a basic types, and in general any application that works with data of a more general UTI should be able to work with data of any UTI that conforms to that general UTI.
Apple public UTIs
The most basic public UTIs in the Apple hierarchy are as follows:
Identifier | Conforms to | Comment |
---|---|---|
public.item | base class in the physical hierarchy | |
public.content | base class for all document content | |
public.data | public.item | base class for all files, byte streams, pasteboard, etc. |
public.image | public.data, public.content | base class for all images |
UTIs are even used to identify other file type identifiers:
Identifier | Conforms to | Comment |
---|---|---|
public.filename-extension | public.case-insensitive-text | Filename extension |
public.mime-type | public.case-insensitive-text | MIME type |
com.apple.ostype | public.text | Four-character code (type OSType )
|
com.apple.nspboard-type | public.text | NSPasteboard type |
Dynamic UTIs can be created as needed by applications; these have the prefix dyn. and take the form of "a UTI-compatible wrapper around an otherwise unknown filename extension, MIME type, OSType, and so on."[1]
Third-party UTIs
Apple provides a large collection of system-declared Uniform Type Identifiers. Third-party applications can add UTIs to the database maintained by macOS by "exporting" UTIs declared within the application package. Because new UTIs can be declared to "conform to" existing system UTIs, and declarations can associate the new UTIs with file extensions, an exported declaration alone can provide the operating system with enough information to enable new functions, such as enabling Quick Look for new file types.
List of common third-party UTIs
Description | UTI | Extensions | Conforms to | MIME types | Ref. |
---|---|---|---|---|---|
OPML document | org.opml.opml | .opml | public.xml | text/xml, text/x-opml, application/xml | [5] |
Markdown document | net.daringfireball.markdown[6] | .md, .markdown | public.plain-text | text/markdown | [7] |
POSIX Paths document | cc.utis.paths-file | .paths | public.utf8-plain-text | not defined | [8] |
Pasteboard Types | org.nspasteboard.TransientType, org.nspasteboard.ConcealedType, org.nspasteboard.AutoGeneratedType, org.nspasteboard.source | not a file type | — | — | [9] |
Looking up a UTI
To get the UTI of a given file, use the
mdls -name kMDItemContentType -name kMDItemContentTypeTree -name kMDItemKind FILE
References
- ^ a b c "Uniform Type Identifiers Overview". Guides and Sample Code. Apple Inc. October 29, 2007. Retrieved September 12, 2016.
- ^ "Uniform Type Identifiers — a reintroduction - Tech Talks - Videos". Apple Developer. Retrieved May 17, 2022.
- ^ "Folklore.org: The Grand Unified Model (2) - The Finder". www.folklore.org. Retrieved April 12, 2018.
- ^ "Mac OS X 10.1 File Name Extension Guidelines - Cocoabuilder". www.cocoabuilder.com. Retrieved April 12, 2018.
- ^ OPML 2.0 spec
- ^ "Uniform Type Identifier For Markdown". Daring Fireball. Retrieved August 21, 2019.
- ^ "Markdown". Daring Fireball.
- ^ DotPathsFileSpec on GitHub
- ^ Identifying and Handling Transient or Special Data on the Clipboard