Skip to content

Instantly share code, notes, and snippets.

@loclv
Last active November 8, 2024 15:13
Show Gist options
  • Select an option

  • Save loclv/c4de3d8eb44631f1d498c71cf09449ba to your computer and use it in GitHub Desktop.

Select an option

Save loclv/c4de3d8eb44631f1d498c71cf09449ba to your computer and use it in GitHub Desktop.
Use duti - a command-line tool to select default applications for document types and URL schemes on Mac OS

On MacOS, use duti:

brew install duti

# vscode
duti -s com.microsoft.VSCode .md all

# confirm
duti -x md
# output: com.microsoft.VSCode

duti -s com.microsoft.VSCode .sql all
duti -s com.microsoft.VSCode .js all
duti -s com.microsoft.VSCode .ts all

To find what ID of the app you want to select, try:

osascript -e 'id of app "Visual Studio Code"'
# output: com.microsoft.VSCode

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment