6

Is there an easy way to find all the extensions that are opened with a given application?
I'm asking because I have two versions of a software installed (Sublime 2 and 3), and some extensions still open with Sublime 2 because by the time I specified that Sublime 3 was not available. I then have to quit Sublime, change the program that shall be opened by default for this extension and relaunch.

I would like to end this once and for all and change it for every remaining extension. Does anyone know of an easy way to do this? Thank you!

4
  • 2
    In terminal, execute defaults read com.apple.LaunchServices.plist >> ~/Desktop/defaults.txt. Open up the text file and find the keys matching each sublime property list. Once identified, you can set those opening with 2 to open with 3. See here
    – njboot
    Commented Aug 28, 2014 at 0:39
  • @nijbot: Thanks for the tip, it brought me on the right track. When I execute your command, it returns an error "Domain com.apple.LaunchServices.plist does not exist". However, there is an additional file ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist, that I opened with Xcode. You can change the default programs there. Commented Aug 28, 2014 at 7:10
  • you're welcome. there's not a simple way at all (AFAIK, or at least from what I looked into) to return the desired information using commands like grep sed or awk since you're matching multiple strings over multiple lines. The easiest way, as you note, is in Xcode. Also, not sure why secure is prepended to the extension, perhaps this is the behavior if you use filevault and your drive is encrypted (I don't), but that's the same file for sure. BOL. Cheers.
    – njboot
    Commented Aug 28, 2014 at 20:42
  • Also, why do you have both versions installed? Uninstalling Sublime 2 and then manually removing it's .plist would solve the immediate issue.
    – njboot
    Commented Aug 28, 2014 at 20:45

2 Answers 2

3

If you want all files with a certain extension (not the 1 specific file) to be opened by a certain app, do the following:

  1. Right click the file and click Get Info (or highlight file and hit cmd ⌘ + i )
  2. Change Open with: to preferred app
  3. Click Change All...
  4. Click Continue in the confirmation box

Is this what you meant to do? This is different from right clicking a file and choosing the 'Always open with' option. That seems to only apply to the specific file, not all files globally.

You will have to repeat this for each extension.

Get info screen Confirmation box

3
  • Thanks for your answer, but I do know of this way. The problem is that I do not know which extensions are bound to Sublime 2. Commented Aug 28, 2014 at 6:58
  • Couldn't you simply 'override' all extensions you want opened with Sublime 3 using this method, once?
    – Kymer
    Commented Aug 28, 2014 at 7:07
  • Sure, but I run the risk that I forget one and end up being annoyed later when I find one I forgot. Commented Aug 28, 2014 at 7:16
3

Open the file ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.‌​plist in Xcode. The file contains all the bindings for extensions to applications.

Find/replacing the values did not work for me, since the file was overwritten every time. But you can use Find to get a list of all the extensions that are opened with a particular application and then change it by hand.

7
  • In my original comment, follow the instructions in the link. You need to change these values using the terminal.
    – njboot
    Commented Aug 28, 2014 at 21:29
  • The problem is that the domain can not be found, thus I did not get it to work via Terminal. Commented Aug 28, 2014 at 21:31
  • edit the domain to com.apple.launchservices.secure.‌​plist
    – njboot
    Commented Aug 28, 2014 at 21:49
  • @njboot yes, I already tried that, same result. The weird thing about all this is that default domains actually does return com.apple.LaunchServices, even though the manpage specifically states that it only considers domains in the space of the user. Commented Aug 28, 2014 at 21:53
  • you may need sudo to edit the plist in that case, even though it's in your user library. Are you running filevault? Also, what happens if you touch ~/Library/Preferences/com.apple.launchservices.plist; mv ~/Library/Preferences/com.apple.launchservices.secure.plist ~/Desktop/. Log out then in. does secure regenerate in your library? are you able to defaults write to the one you created?
    – njboot
    Commented Aug 28, 2014 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .