CLI to associate UTI and Extension to an application.
Stand alone executable Swift program.
brew install aerobounce/tap/approle
approle id <Application Name>
approle uti <Extension>...
approle list [Conforming UTI...] [!Non-Conforming UTI...]
approle tree <Object Path>
approle set <(Application Name | Bundle Identifier)> <(UTI | Extension)>...
approle help
> approle id TextEdit
com.apple.TextEdit
> approle id Xcode
com.apple.dt.Xcode
> approle uti sh py rb
public.shell-script # .sh
public.python-script # .py
public.ruby-script # .rb
# List all UTIs which conform to `public.archive` excluding UTIs conform to `public.disk-image`.
> approle list "public.archive" "!public.disk-image"
com.winzip.zipx-archive
org.tukaani.lzma-archive
public.lzip-archive
public.lzip-tar-archive
public.lzop-archive
public.lzop-tar-archive
public.lrzip-archive
public.lrzip-tar-archive
...
> approle tree ./example.txt
public.plain-text
public.text
public.data
public.item
public.content
> approle tree ./example.md
net.daringfireball.markdown
public.plain-text
public.text
public.data
public.item
public.content
> approle set Xcode sh public.python-script rb
Succeeded: com.apple.dt.Xcode -> public.shell-script (.sh)
Succeeded: com.apple.dt.Xcode -> public.python-script
Succeeded: com.apple.dt.Xcode -> public.ruby-script (.rb)
approle set Xcode << EOF
c h hh m mm
swift
EOF
Succeeded: com.apple.dt.Xcode -> public.c-source (.c)
Succeeded: com.apple.dt.Xcode -> public.c-header (.h)
Succeeded: com.apple.dt.Xcode -> public.c-plus-plus-header (.hh)
Succeeded: com.apple.dt.Xcode -> public.objective-c-source (.m)
Succeeded: com.apple.dt.Xcode -> public.objective-c-plus-plus-source (.mm)
Succeeded: com.apple.dt.Xcode -> public.swift-source (.swift)
# Set Xcode as default application for all the UTIs conform to `public.source-code`.
approle list "public.source-code" | approle set Xcode
# Better to skip too generic UTIs.
approle tree ./example.md |
grep -v -E 'public.(item|folder|directory|data|content)' |
approle set Xcode