Skip to content

Instantly share code, notes, and snippets.

@mahmoudimus
Last active January 17, 2025 18:58
Show Gist options
  • Save mahmoudimus/edc8b1284df7669880f0166e3a05c4d1 to your computer and use it in GitHub Desktop.
Save mahmoudimus/edc8b1284df7669880f0166e3a05c4d1 to your computer and use it in GitHub Desktop.
Allows one to change the default file handler for `public.data` content types on Mac OS
bundleid=$(mdls <APP_PATH_HERE> | grep kMDItemCFBundleIdentifier | cut -d'"' -f2)

defaults write com.apple.LaunchServices LSHandlers -array-add \
     "{ LSHandlerContentType = \"public.data\"; LSHandlerRoleAll = \"$bundleid\"; };"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment