A macOS command line tool to reveal a file’s UTI

Latest Release: 1.2.0

 New Version

 

Download And Install utitool

You can install utitool using Brew. In Terminal, just run:

brew tap smittytone/homebrew-smittytone

brew install --cask utitool


Alternatively, click the file link below to download utitool.
Please verify the integrity of the download with the SHA-256 checksum.

File Name utitool_1_2_0.dmg
File Size 147KB

 

How to Use utitool

utitool is a macOS command line tool to help you discover files’ Uniform Type Identifiers (UTIs). macOS uses these to match data files to applications that can edit or view them. For example, PreviewMarkdown works with a number of UTIs, such as net.daringfireball.markdown and net.ia.markdown, to provide previews of markdown files.

In Terminal, run:

utitool [file path 1] [file path 2] ... [file path n]

utitool in use

Use the --more (or -m) switch for more details:

utitool in use

To learn about a specific file extension, eg. .md, use the --extension (-e`) option. There’s no need to prefix the extension with a period.

To learn about a specific uti, eg. net.daringfireball.markdown, use the --uti (-u`) option:

utitool in use

To view the information the system holds for all of the UTIs that are registered with it, use the --list (-l) switch:

utitool in use

You can also view the system’s applications records by UTI, using the --apps (-a) switch:

utitool in use

Both this settings will result in extensive amounts of information. Although they output in human-readable form, finding the right application or UTI can be tricky. For this reason, you can optional output the data in JSON format — add the --json (-j) switch. The output can be passed to JSON processing tools, such as jq, to allow you to drill down to the data you want:

utitool in use

For apps, the JSON structure is an object comprising one object for each recorded application. Each app object contains a uti field whose value is an array of UTI records. For example:

"PreviewMarkdown": {
    "name": "PreviewMarkdown",
    "utis": [
        {
            "extensions": [
                ".md",
                ".mdown",
                ".markdown",
                ".mdwn",
                ".mdml",
                ".multimarkdown",
                ".mkd",
                ".mmd",
                ".ft",
                ".text"
            ],
            "mimeTypes": [
                "text/markdown",
                "text/x-markdown",
                "text/x-web-markdown"
            ],
            "parents": [
                "public.data",
                "public.content",
                "public.text",
                "public.plain-text",
                "public.markdown"
            ],
            "uti": "net.daringfireball.markdown"
        }
    ]
}

For UTIs, the JSON structure is an object comprising one object for each recorded UTI. For example:

 "net.daringfireball.markdown": {
    "apps": [
        {
            "name": "PreviewMarkdown",
            "utis": []
        },
        {
            "name": "Xcode",
            "utis": []
        }
    ],
    "extensions": [
        ".md",
        ".mdown",
        ".markdown",
        ".mdwn",
        ".mdml",
        ".multimarkdown",
        ".mkd",
        ".mmd",
        ".ft",
        ".text"
    ],
    "mimeTypes": [
        "text/markdown",
        "text/x-markdown",
        "text/x-web-markdown"
    ],
    "parents": [
        "public.data",
        "public.content",
        "public.text",
        "public.plain-text",
        "public.markdown"
    ],
    "ref": "",
    "uti": "net.daringfireball.markdown"
}

Important Because the UTIs contain periods/full stops, and these are reserved characters for jq, you will need to quote UTIs. For example:

> utitool --list --json | jq '."net.daringfireball.markdown".extensions'
[
  ".md",
  ".mdown",
  ".markdown",
  ".mdwn",
  ".mdml",
  ".multimarkdown",
  ".mkd",
  ".mmd",
  ".ft",
  ".text"
]

Examples

Get data for all the files in the working directory:

$ utitool *

Get data for a named file in the working directory:

$ utitool text.md

Get data for named files in the working directory:

$ utitool text1.md text2.md

Get data for any named file:

$ utitool /User/me/text1.md

Get data for a named file in the parent directory:

$ utitool ../text1.md

Get extra data for a named file in the parent directory:

$ utitool ../text1.md --more

Get UTI information for a particular file extension:

$ utitool --extension nii

Get extra data for a particular UTI:

$ utitool --uti com.bps.rust-source

Source Code

You can view Utitool’s source code at GitHub.


Release Notes

  • 1.2.0 12 August 2025
    • Add --list and --app options to retrieve and display system-recorded information for, respectively, UTIs and apps.
    • Support machine- or human-readable output for the above commands, with the --json switch for the former.
    • Add UTITOOL_USE_DARK_COLOUR environment variable for users with dark-on-light Terminal colouring.
  • 1.1.0 1 August 2025
    • Add extra file information when viewing a file’s UTI.
    • Add --extension option to show info about specified a file extension.
    • Add --uti option to show info about a specified UTI.
    • Add --more option to show extra UTI information about specified files.
  • 1.0.4 23 July 2021
    • Add async signal safe ctrl-c trapping code.
  • 1.0.3 15 June 2021
    • Add support for macOS 11 Big Sur’s UTType API.
  • 1.0.2 8 February 2021
    • Minor help text change.
  • 1.0.1 4 February 2021
    • Tiny bit of refactoring.
  • 1.0.0 12 January 2021
    • Initial public release.

Related Software


smittytonesmittytone
Site and software copyright © 2025, Tony Smith