osx - Batch change filetype associations on OS X

06
2014-04
  • wbg

    I just installed Sublime Text 3 beta and would like to re-associate all the filetypes I have linked to ST 2 with ST 3.

    Is there any way to perform this as a batch operation?

    For example:

    $ open_all_with_st3 py txt tsv css scss js ...
    

    Or better yet, get a list of all types associated with ST 2 and then assign them to ST 3.

    I really don't fancy doing the Get Info->Open With->Change All … dance with dozens of filetypes.

  • Answers
  • wbg

    I figured it out. I opened ~/Library/Preferences/com.apple.LaunchServices.plist and replaced all occurrences of com.sublimetext.2 with com.sublimetext.3.


  • Related Question

    osx - How to change file associations on Mac OS X?
  • Jonik

    By default PNG images open in Preview. At some point, this has changed on my system so that clicking on a PNG file launches Paintbrush. While that's a really nice app, I'd still like the default to be Preview. How to change it back? (I formulated the question title to be little more generic — how to do this for any file types?)

    I'm looking for the easiest, most readily-available way, with no 3rd party tools or going to the command-line. Somewhat surprisingly, System Preferences seems to contain nothing related to file associations.

    This beginner question should probably be an easy one... I hope!


  • Related Answers
  • 8088
    1. Get Info on the file in Finder (⌘I)
    2. Find the "Open with:" section
    3. Change the application to the one you want
    4. Click "Change All…" to apply the change for all files of the same type.

    Info window