TIL: macOS

← all TIL

macOS: set the default app for a file type with duti

· macOS

duti takes a bundle identifier and binds it to a file extension (or UTI). Combine it with osascript to look up the bundle id of the app you actually have installed.

brew install duti

# Figure out the bundle id of the app you want.
osascript -e 'id of app "Zed"'

# Bind .yml files to that app, for all roles (viewer + editor).
duti -s "$(osascript -e 'id of app "Zed"')" .yml all