Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

duti

> 编程语言
Open source

A command-line tool to select default applications for document types and URL schemes on Mac OS X

2.0K stars0 likes0 views
WebsiteGitHub

About

A command-line tool to select default applications for document types and URL schemes on Mac OS X

duti

duti is a command-line utility capable of setting default applications for various document types on macOS, using Apple's Uniform Type Identifiers (UTI). A UTI is a unique string describing the format of a file's content. For instance, a Microsoft Word document has a UTI of com.microsoft.word.doc. Using duti, the user can change which application acts as the default handler for a given UTI.

Compiling

bash
autoreconf -i
./configure
make
sudo make install

Usage

duti can read settings from four different sources:

  1. standard input

  2. a settings file

  3. an XML property list (plist)

  4. command-line arguments.

A settings line, as read in cases 1 and 2, consists of an application's bundle ID, a UTI, and a string describing what role the application handles for the given UTI. The process is similar when duti processes a plist. If the path given to duti on the command-line is a directory, duti will apply settings from all valid settings files in that directory, excluding files whose names begin with . (single dot).

duti can also print out the default application information for a given extension (-x). This feature is based on public domain source code posted by Keith Alperin on the heliumfoot.com blog.

See the man page for additional usage details.

Examples

  • Set Safari as the default handler for HTML documents:

    bash
    duti -s com.apple.Safari public.html all
  • Set TextEdit as the default handler for Word documents:

    bash
    echo 'com.apple.TextEdit   com.microsoft.word.doc all' | duti
  • Set Finder as the default handler for ftp:// URLs:

    bash
    duti -s com.apple.Finder ftp
  • Get default application information for .jpg files:

    bash
    duti -x jpg
    
    # Output
    Preview
    /Applications/Preview.app
    com.apple.Preview

Support

duti is unsupported. You can submit bug reports and feature requests at the duti GitHub project page.

Related

dutis is a wrapper around duti, providing an interactive interface to select default applications.

License

duti was originally released into the public domain by Andrew Mortensen in 2008. It's provided as is without warranties of any kind. You can do anything you want with it. If you incorporate some or all of the code into another project, I'd appreciate credit for the work I've done, but that's all.

Andrew Mortensen April 2018

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言