duti(1)
π duti(1) β the manual, but make it make sense
okay so first things first: this is the duti(1) page, and it lives in the User Commands section of your manual. she's a macOS girlie and she's here to make your default apps behave. let's get into it π
β¨ NAME β¨
duti β set default document and URL handlers. that's it, that's the whole vibe. she picks which app opens what, and she does not miss. π
πΈ SYNOPSIS πΈ
duti [ -hVv ] [ -d uti ] [ -l uti ] [ settings_path ]
duti -s bundle_id { uti | url_scheme | extension | MIME_type } [ role ]
duti -x extension
π¦ DESCRIPTION π¦
so duti sets applications as default handlers for Apple's Uniform Type Identifiers (UTIs), for URL schemes, filename extensions, and MIME types. literally the whole roster. π
if settings_path is not given on the command line, duti reads settings lines from stdin. if settings_path is a directory, duti applies settings from the files in settings_path. flexible queen.
the -s flag tells duti to set a handler based on arguments from the command line. here's the read:
- two arguments following
-sβdutisets the handler for a URL scheme. - three arguments following
-sβdutisets the handler for a UTI, an extension or a MIME type, depending on the formatting of the second argument.
and how does she decide which is which? bestie, she's reading the formatting:
- an argument beginning with a dot β treated as an extension.
- an argument containing no dots β also considered a filename extension, unless it contains a slash, in which case
dutitreats the argument as a MIME type. - all other cases β the second argument is treated as a UTI.
duti -x retrieves and prints out information describing the default application for files with the extension extension. cute little peek behind the curtain. π
see EXAMPLES below for usage cases. π
π SETTINGS FILE π
a settings file is made up of lines with the following format:
app_id UTI role
the app_id is a bundle ID representing the application that will act as the handler for documents associated with UTI. for example:
com.apple.Safari public.html all
would cause duti to set Safari as the default handler in all situations for HTML documents. slay. π¦
a settings file can also contain lines with this format:
app_id url_scheme
in this case, app_id is again a bundle ID, this time for the application that will act as the default handler for url_scheme. for example:
org.mozilla.Firefox ftp
would cause duti to set Firefox as the handler for "ftp://" URLs. no cap. π₯
π§ SETTINGS PLIST π§
if the extension of the file given to duti is .plist, duti treats the file as an XML property list (plist). the plist must contain a key-value pair in which the key is "DUTISettings" and the value is an array of dictionaries.
each dictionary in the array contains three key-value pairs representing the application's bundle ID, the UTI and the role, respectively. alternatively, a dictionary in the array may contain two key-value pairs representing the application's bundle ID, and the URL scheme.
a simple plist designed to set Safari as the default handler of HTML files, and Firefox as the default handler for "ftp://" URLs, would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DUTISettings</key>
<array>
<dict>
<key>DUTIBundleIdentifier</key>
<string>com.apple.Safari</string>
<key>DUTIUniformTypeIdentifier</key>
<string>public.html</string>
<key>DUTIRole</key>
<string>all</string>
</dict>
<dict>
<key>DUTIBundleIdentifier</key>
<string>org.mozilla.Firefox</string>
<key>DUTIURLScheme</key>
<string>ftp</string>
</dict>
</array>
</dict>
</plist>
π ROLES π
valid roles are defined as follows β think of it as the job description for each app:
allβ application handles all roles for the given UTI. she does it all, main character energy. πviewerβ application handles reading and displaying documents with the given UTI.editorβ application can manipulate and save the item. impliesviewer.shellβ application can execute the item. πnoneβ application cannot open the item, but provides an icon for the given UTI. icon-only era, we respect it. π
π EXAMPLES π
running duti with -s :
# Set Safari as the default handler for HTML documents
duti -s com.apple.Safari public.html all
# Set Finder as the default handler for the ftp:// URL scheme
duti -s com.apple.Finder ftp
retrieving default application information for an extension:
# default application information for .html files
% duti -x html
Safari
/Applications/Safari.app
com.apple.Safari
the following examples can be used by passing them to duti on stdin or as lines in a .duti file. π«Ά
set TextEdit as the default viewer for Microsoft Word documents:
com.apple.TextEdit com.microsoft.word.doc viewer
set VLC as the default viewer for files with .m4v extensions:
org.videolan.vlc m4v viewer
set iHook as the default executor of shell scripts:
edu.umich.iHook public.shell-script shell
set Xcode as the default editor for C source files:
com.apple.Xcode public.c-source editor
β OPTIONS β
-duti β display the default handler for uti and exit.-hβ print usage and exit.-luti β display all handlers for uti and exit.-sβ set the handler from data provided on the command line.-Vβ print version number and exit.-vβ verbose output.-xext β print information describing the default application for extension ext.
π EXIT STATUS π
0β all settings applied or displayed successfully. we ate. π1β settings could not be applied, or the UTI has no handler. rough. π>1β error.
π MORE INFO π
macOS ships with a number of UTIs already defined. most third-party software is responsible for defining its own UTIs. Apple documents UTIs in the Apple Developer Documentation Archive at:
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html
to get a list of UTIs on your system, you can use the following command line:
$(mdfind -name lsregister) -dump | grep '[[:space:]]uti:' \
| awk '{ print $2 }' | sort | uniq
π SEE ALSO π
plutil(1), plist(5) β go read those next, bestie, they're lowkey essential.
ngl, that's the whole page. every flag, every role, every plist key β nothing skipped, nothing invented. iykyk. π
okay and like a proper sign-off: this page was written by Andrew Mortensen, it's the _DUTI_BUILD_DATE build, and the manual page is duti(1). periodt. π
β¨
π¦ where this page comes from
- nixpkgs unstable: duti 1.5.5pre
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms