duti
duti [ -hVv ] [ settings_path ]
duti sets applications as default handlers for Apple's Uniform Type
Identifiers. 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.
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. 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 applica-
tion 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.
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. 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>
Valid roles are defined as follows:
all application handles all roles for the given UTI.
viewer application handles reading and displaying documents
with the given UTI.
editor application can manipulate and save the item.
Implies viewer.
shell application can execute the item.
none application cannot open the item, but provides an
icon for the given UTI.
The following sets TextEdit as the default viewer for Microsoft Word
documents.
com.apple.TextEdit com.microsoft.word.doc viewer
The following sets iHook as the default executor of shell scripts.
edu.umich.iHook public.shell-script shell
The following sets Xcode as the default editor for C source files.
com.apple.Xcode public.c-source editor
-h print usage and exit.
-V print version number and exit.
-v verbose output.
0 All settings applied successfully.
1 One or more settings could not be applied.
>1 Error.
Mac OS X 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 Connection Library at:
http://developer.apple.com/referencelibrary/
To get a list of UTIs on your system, you can use the following command
line:
`locate lsregister` -dump | grep '[[:space:]]uti:' \
| awk '{ print $2 }' | sort | uniq
plutil(1), plist(5)
Man(1) output converted with
man2html