duti



SYNOPSIS

       duti [ -hVv ] [ settings_path ]



DESCRIPTION

       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.

       The -s flag tells duti to set a handler based  on  arguments  from  the
       command  line.  Two arguments following -s means that duti will set the
       handler for a URL scheme. Three arguments means duti will set the  han-
       dler  for  a UTI, an extension or a MIME type, depending on the format-
       ting of the second argument.  duti treats an argument beginning with  a
       dot  as  an extension. If the argument contains no dots, duti also con-
       siders the argument a filename extension, unless it contains  a  slash,
       in  which  case  duti  treats the argument as a MIME type. In all other
       cases, duti treats the second argument as a UTI.

       duti -x retrieves and prints out  information  describing  the  default
       application for files with the extension extension.

       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.  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.



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.  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>


ROLES

       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.


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 can be used by passing them to duti on stdin or
       as lines in a .duti file.

	Set TextEdit as the default view 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

       -d uti             display the default handler for uti and exit.

       -h                 print usage and exit.

       -l uti             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.

       -x ext             print information describing the default application
                          for extension ext.


EXIT STATUS

       0    All settings applied or displayed successfully.

       1    Settings could not be applied, or the UTI has no handler.

       >1   Error.



MORE INFO

       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



SEE ALSO

       plutil(1), plist(5)


Man(1) output converted with man2html