With duti you can set the default application for a document type (UTI) or for a URL scheme.

  • Install: brew install duti
  • Create config file vim ~/.duti:

      # bundle id         UTI/ext/MIME type   role
      com.apple.Safari    public.html         all
      com.sublimetext.3   public.plain-text   all
      # bundle id         URL scheme
      org.mozilla.Firefox feed
  • Apply settings: duti ~/.duti
  • Enjoy!

PS. You can use mdls utility to determine UTI is for a specific file. And codesign (codesign --display -r - <path>) to find a bundle id of app.