I\'m trying to register a custom protocol to an application on the Mac, i.e:
As of today, the best way I found to solve this problem on a Mac with the least overhead is using the command line duti which allows me to define in a very simple text file all my associations:
brew install duti
You will need two things. First bundle ids of the Apps you want to associate:
mdls -name kMDItemCFBundleIdentifier /Applications/MacVim.app
Second the UTI of the file type, Apple provides a list, but you can also explore the supported UTI by your app like this:
mdls -name kMDItemContentTypeTree /Applications/MacVim.app
Now make a text file somewhere in your system where you associate bundle ids with UTI:
# ~/.default-apps.duti
#
# bundle id UTI role
com.apple.Safari public.html all
org.vim.MacVim txmt
org.vim.MacVim public.ruby-script
Notice that I can associate a URL handler like txmt and also file types like Ruby scripts.
In that file you I keep track of all my app preferences and reproduce them immediately after a complete fresh install or when getting an account on other Mac just running:
duti ~/.default-apps.duti