Skip to content

The Eclectic Light Company

Macs & painting – 🦉 No AI content
Main navigation
  • Downloads
  • Freeware
  • M-series Macs
  • Mac Problems
  • Mac articles
  • Macs
  • Art
hoakley January 24, 2018 Macs, Technology, xattr

File types, the UTI, and even more metadata

We use URLs all the time, sometimes have to work in UTC, and occasionally stumble over UUIDs, but what is a UTI, where would you use one, and what do they have to do with metadata?

In theory, only developers, and others who enjoy life up to their neck in the alligators of macOS, should come across Apple’s Uniform Type Identifiers. But as they appear in many property lists and in the output of command tools, and are central to features such as Launch Services, it is as well to be familiar with them.

UTIs came about because of multiple systems for identifying file types in macOS. Classic Mac OS used a four-character code, the OSType, half of the Finder Info which underpinned its Desktop illusion, associating apps with documents. In that, a JPEG image file is known by the characters JPEG, unsurprisingly. But macOS also had its origins in NeXTStep, which was essentially Unix, and believed instead in file extensions such as .jpeg or .jpg. Then along came MIME (or media) types, used primarily to define content types on the internet, in email messages, and so on. Under those, that JPEG image is image/jpeg.

With three incompatible systems to choose between, Apple decided to create a fourth, the UTI. In that, the image is public.jpeg.

UTIs are an extensive, hierarchical classification system for anything you can find stored in a computer. At the top is public.item: every file, folder, bundle, etc., is a public.item. Then the naming gets progressively more specific: the image eventually works its way down to the most specific public.jpeg.

Apps have to declare the types of documents which they can read and write, something recorded in their property lists, which are in turn used by Launch Services to decide which app gets to open which type of document. Although this system still uses and respect OSTypes, extensions, and MIME types, it just loves a good UTI.

UTIs are also used with pasteboards, which are the basis for cut-copy-paste operations, drag and drop, Services, and a few other everyday bits of magic which apps perform with macOS.

The easiest way to see UTIs is using Terminal’s mdls command to list metadata, as they’re counted as being (a very important) part of every file’s metadata. The command to view just the UTI hierarchy for a file named filename is
mdls -name kMDItemContentTypeTree filename

But let’s go the whole hog and view all the metadata for a text file which I have nobbled with SearchKey so that it has five extra extended attributes. This is simple using a command like
mdls 0test.txt
and produces:
_kMDItemOwnerUserID = 501
kMDItemContentCreationDate = 2017-10-26 18:47:05 +0000
kMDItemContentModificationDate = 2017-10-26 18:47:05 +0000
kMDItemContentType = "public.plain-text"
kMDItemContentTypeTree = ("public.plain-text", "public.item", "public.text", "public.data", "public.content", "public.plain-text")
kMDItemCopyright = "Copyright © 2018 EHN & DIJ Oakley"
kMDItemCreator = "Howard Oakley"
kMDItemDateAdded = 2018-01-21 20:03:00 +0000
kMDItemDescription = "This is just a test file of sorts."
kMDItemDisplayName = "0test.txt"
kMDItemFSContentChangeDate = 2017-10-26 18:47:05 +0000
kMDItemFSCreationDate = 2017-10-26 18:47:05 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "0test.txt"
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 391
kMDItemFSTypeCode = ""
kMDItemHeadline = "The News Headlines 3"
kMDItemKeywords = ("key; lock; padlock; chain; safe")
kMDItemKind = "Plain Text Document"
kMDItemLastUsedDate = 2018-01-22 09:46:51 +0000
kMDItemLogicalSize = 391
kMDItemPhysicalSize = 4096
kMDItemUseCount = 45
kMDItemUsedDates = ("2018-01-21 00:00:00 +0000", "2018-01-22 00:00:00 +0000")

If you now change the extension of that file to .png and repeat the command, you have changed some of those metadata. macOS thinks that’s a PNG image file, so the UTIs have changed to reflect that:
kMDItemContentType = "public.png"
kMDItemContentTypeTree = ("public.item", "public.png", "public.data", "public.image", "public.content")
kMDItemKind = "Portable Network Graphics image"

mdls is one of a group of commands which work with metadata in its broadest sense. Also worth knowing are mdfind, which searches the metadata store and returns a list of files satisfying a query, and mdutil, which controls metadata stores on each volume, and can for example force them to be rebuilt. Those are quite complex if not awesome commands which are best left to their man pages.

Hopefully this helps explain how file typing, metadata, Launch Services, and the amazing illusions created by macOS all hold together. If you want to read more, Apple provides a Uniform Type Identifiers Overview, and a UTI Reference with all the gory details.

Oh, and for those of you who thought that UTI stands for urinary tract infection, keep drinking plenty of fluids.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print
Like Loading...

Related

Posted in Macs, Technology, xattr and tagged extensions, files, Finder, LaunchServices, macOS, mdfind, mdls, mdutil, metadata, MIME, pasteboard, UTI. Bookmark the permalink.

Quick Links

  • Free Software Menu
  • System Updates
  • M-series Macs
  • Mac Troubleshooting Summary
  • Mac problem-solving
  • Painting topics
  • Painting
  • Long Reads

Search

Monthly archives

  • December 2025 (63)
  • November 2025 (74)
  • October 2025 (75)
  • September 2025 (78)
  • August 2025 (76)
  • July 2025 (77)
  • June 2025 (74)
  • May 2025 (76)
  • April 2025 (73)
  • March 2025 (78)
  • February 2025 (67)
  • January 2025 (75)
  • December 2024 (74)
  • November 2024 (73)
  • October 2024 (78)
  • September 2024 (77)
  • August 2024 (75)
  • July 2024 (77)
  • June 2024 (71)
  • May 2024 (79)
  • April 2024 (75)
  • March 2024 (81)
  • February 2024 (72)
  • January 2024 (78)
  • December 2023 (79)
  • November 2023 (74)
  • October 2023 (77)
  • September 2023 (77)
  • August 2023 (72)
  • July 2023 (79)
  • June 2023 (73)
  • May 2023 (79)
  • April 2023 (73)
  • March 2023 (76)
  • February 2023 (68)
  • January 2023 (74)
  • December 2022 (74)
  • November 2022 (72)
  • October 2022 (76)
  • September 2022 (72)
  • August 2022 (75)
  • July 2022 (76)
  • June 2022 (73)
  • May 2022 (76)
  • April 2022 (71)
  • March 2022 (77)
  • February 2022 (68)
  • January 2022 (77)
  • December 2021 (75)
  • November 2021 (72)
  • October 2021 (75)
  • September 2021 (76)
  • August 2021 (75)
  • July 2021 (75)
  • June 2021 (71)
  • May 2021 (80)
  • April 2021 (79)
  • March 2021 (77)
  • February 2021 (75)
  • January 2021 (75)
  • December 2020 (77)
  • November 2020 (84)
  • October 2020 (81)
  • September 2020 (79)
  • August 2020 (103)
  • July 2020 (81)
  • June 2020 (78)
  • May 2020 (78)
  • April 2020 (81)
  • March 2020 (86)
  • February 2020 (77)
  • January 2020 (86)
  • December 2019 (82)
  • November 2019 (74)
  • October 2019 (89)
  • September 2019 (80)
  • August 2019 (91)
  • July 2019 (95)
  • June 2019 (88)
  • May 2019 (91)
  • April 2019 (79)
  • March 2019 (78)
  • February 2019 (71)
  • January 2019 (69)
  • December 2018 (79)
  • November 2018 (71)
  • October 2018 (78)
  • September 2018 (76)
  • August 2018 (78)
  • July 2018 (76)
  • June 2018 (77)
  • May 2018 (71)
  • April 2018 (67)
  • March 2018 (73)
  • February 2018 (67)
  • January 2018 (83)
  • December 2017 (94)
  • November 2017 (73)
  • October 2017 (86)
  • September 2017 (92)
  • August 2017 (69)
  • July 2017 (81)
  • June 2017 (76)
  • May 2017 (90)
  • April 2017 (76)
  • March 2017 (79)
  • February 2017 (65)
  • January 2017 (76)
  • December 2016 (75)
  • November 2016 (68)
  • October 2016 (76)
  • September 2016 (78)
  • August 2016 (70)
  • July 2016 (74)
  • June 2016 (66)
  • May 2016 (71)
  • April 2016 (67)
  • March 2016 (71)
  • February 2016 (68)
  • January 2016 (90)
  • December 2015 (96)
  • November 2015 (103)
  • October 2015 (119)
  • September 2015 (115)
  • August 2015 (117)
  • July 2015 (117)
  • June 2015 (105)
  • May 2015 (111)
  • April 2015 (119)
  • March 2015 (69)
  • February 2015 (54)
  • January 2015 (39)

Tags

APFS Apple Apple silicon backup Big Sur Blake Bonnard bug Catalina Consolation Console Corinth Delacroix Disk Utility Doré El Capitan extended attributes Finder firmware Gatekeeper Gérôme High Sierra history of painting iCloud Impressionism landscape LockRattler log M1 Mac Mac history macOS macOS 10.12 macOS 10.13 macOS 10.14 macOS 10.15 macOS 11 macOS 12 macOS 13 macOS 14 macOS 15 malware Metamorphoses Mojave Monet Monterey Moreau myth narrative OS X Ovid painting performance Pissarro Poussin privacy Renoir riddle Rubens Sargent security Sierra SilentKnight Sonoma SSD Swift Time Machine Tintoretto Turner update upgrade Ventura xattr Xcode XProtect

Statistics

  • 21,003,587 hits
Blog at WordPress.com.
Footer navigation
  • Free Software Menu
  • About & Contact
  • Macs
  • Painting
  • Downloads
  • Mac problem-solving
  • Extended attributes (xattrs)
  • Painting topics
  • SilentKnight, Skint, SystHist, silnite, LockRattler & Scrub
  • DelightEd & Podofyllin
  • xattred, SpotTest, Spotcord, Metamer & xattr tools
  • 32-bitCheck & ArchiChect
  • XProCheck, T2M2, LogUI, Ulbow, blowhole and log utilities
  • Cirrus & Bailiff
  • Precize, Alifix, UTIutility, Sparsity, alisma, Taccy, Signet
  • Versatility & Revisionist
  • Text Utilities: Textovert, Nalaprop, Dystextia and others
  • PDF
  • Keychains & Permissions
  • Updates
  • Spundle, Cormorant, Stibium, DropSum, Dintch, Fintch and cintch
  • Long Reads
  • Mac Troubleshooting Summary
  • M-series Macs
  • Mints: a multifunction utility
  • VisualLookUpTest
  • Virtualisation on Apple silicon
  • System Updates
  • Saturday Mac Riddles
  • Last Week on My Mac
  • sysctl information
Secondary navigation
  • Search

Post navigation

What is in the High Sierra 10.13.3 update?
What is in the Sierra Security Update 2018-001?

Begin typing your search above and press return to search. Press Esc to cancel.

  • Reblog
  • Subscribe Subscribed
    • The Eclectic Light Company
    • Join 8,887 other subscribers
    • Already have a WordPress.com account? Log in now.
    • The Eclectic Light Company
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
%d