duti

一款命令行工具,用于在 Mac OS X 上为文档类型和 URL 方案选择默认应用程序。「A command-line tool to select default applications for document types and URL schemes on Mac OS X」

Github星跟踪图

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

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:

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

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

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

    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.

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

主要指标

概览
名称与所有者moretension/duti
主编程语言C
编程语言 (语言数: 6)
平台
许可证Other
所有者活动
创建于2012-09-25 10:13:01
推送于2023-07-09 19:57:53
最后一次提交2023-07-09 19:57:53
发布数13
最新版本名称duti-1.5.4 (发布于 2018-04-13 11:20:09)
第一版名称dh-0-1-0 (发布于 )
用户参与
星数1.8k
关注者数23
派生数74
提交数96
已启用问题?
问题数41
打开的问题数23
拉请求数12
打开的拉请求数3
关闭的拉请求数7
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?