What are those Us? A journey with UTIutility version 1.0

We keep coming across two macOS features beginning with the letter U, like UUID and UTI, aside from the well-known URL and its relative URI. This article disentangles UUID from UTI, explains why they’re so important, and what you can do with each.

UUID

Wherever you turn now, macOS keeps using these groups of hex digits, like 1234A678-1B34-1C34-1D34-1234567890ABUniversally Unique Identifiers. Your Mac has plenty: a Hardware UUID, one for every disk, container and volume in APFS, and many more.

In truth, they’re not all true UUIDs: some are GUIDs, which are composed from carefully-chosen data rather than generated in a standard way to be unique. The first two groups of 8+4 hex digits and part of the third and fourth groups of 4 hex digits give the time at which the UUID was issued. The third and fourth groups of 4 hex digits also give a version and variant of the UUID being used, and the final 12 hex digits give a ‘node id’, which could be a MAC address, for example.

Each should be globally unique, and used to identify an item or event, but there’s no local or global registry of UUIDs. Instead, each is used for a specific purpose. The log uses them to refer to extended log entries and they label events and activities which appear there.

A few aren’t even unique. macOS uses fixed UUIDs to identify types of disk partition: 48465300-0000-11AA-AA11-00306543ECAC is an HFS+ partition, and 7C3457EF-0000-11AA-AA11-00306543ECAC is an APFS container. The nil UUID of 00000000-0000-0000-0000-000000000000 should never be used.

If you need to work out what a UUID refers to, you must first discover its context, and that should enable you to work out which of the hundreds of SQLite and other databases in which to look it up. On its own, a UUID is both meaningless and almost worthless. You can even generate your own at the command line, using uuidgen

So a UUID is just a label, and normally tells you nothing about the item to which it refers.

UTI

Apple’s Uniform Type Identifiers, UTIs, are almost the exact opposite of UUIDs in that they identify what sort of thing an item is using a structured hierarchical taxonomy. Their most obvious role is in declaring different types of files.

It’s often claimed that macOS depends on filename extensions to determine different types of file, but that’s incorrect: macOS is far more capable, and uses MIME types when downloading from the Internet, can still use old Classic Mac OS four-character type codes, but ultimately relies on UTIs.

This is easily demonstrated in Terminal. Type the following command
touch notypefile
to create a new file in the current directory without any extension or other clue as to what it is. Then look in Finder’s Get Info dialog, and you should see that macOS has already assigned it a default type which associates it with TextEdit. Inspect that file using my free utility Precize, and you’ll see that it has a UTI (listed in the Type entry) of public.data.

Now give it an extension which is unknown to macOS, such as .xyz, and inspect it again with Precize: its type has changed to something more cryptic like dyn.ah62d4rv4ge81u8p4. That’s a dynamic UTI, created on the fly by macOS to distinguish it as having a unique type, described in Get Info simply as a Document, but still with TextEdit as its default associated app.

Every item in your Mac’s file system has a UTI, which tells Launch Services what to do when you try to open it, for instance by double-clicking its icon. There is an exception to this, which forms a longstanding bug dating back to the introduction of UTIs in 2007: some files may not return a UTI, but a NULL instead. This seems to be confined to sockets, which appear to be files but aren’t really.

Unfortunately, although discovering UTIs is key to dealing with documents which are treated as having the wrong type, there’s no easy way to find a file’s UTI in macOS. Not only that, but Apple hasn’t updated its documentation of UTIs for the last decade or so, so even when you do know a UTI, chances are that it won’t be listed there.

Thankfully, you don’t need long reference lists to find out key information such as what a filename extension or MIME type represents in terms of a UTI: it’s all contained within macOS, if you know where to look. My free app UTIutility gives ready access to the 600 or so UTIs in common use. If you want to know what an extension maps to, just type the extension in, and UTIutility tells you its UTI, MIME type(s), and everything it can find out about that type.

UTIs

This first full release version of UTIutility:

  • contains an extensive Help book, including the above structural reference to the 50 most important UTIs,
  • checks it own integrity each time it opens, and
  • contains a direct link to its product page.

UTIutility version 1.0 is now available from here: utiutil10
from Downloads above, and from its product page. It runs in El Capitan, Sierra, High Sierra and Mojave.