duti - command to set default applications

Sep 10, 2023


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.

example usage - I want to set IINA to be the default player for webm files. First, check what the current setting is:

$ duti -x webm

to change it, I need the bundle id of iina. Googling suggests that mdls is the tool I want:

$ mdls -name kMDItemCFBundleIdentifier -r /Applications/IINA.app 

Now I can set IINA to be the opener for webm files with:

$ duti -s com.colliderli.iina webm all

Unfortunately, the tool has no documentation - it's a short C file though.

↑ up