6

Every time I get a machine that I install Xcode on, it associates itself with all kinds of filetypes. E.g., .xml, .rb, even .java! It's such a nuisance to have to re-associate those file extensions individually. If I want to open Xcode, I'll open Xcode, but I never want to open Xcode by double-clicking on a script or using open.

Is there any way to globally disassociate Xcode from all file types? More generally, is there any way to do this for any app (e.g., QuickTime)?

PS: I know about How to Change File Type Associations? but this aims at changing one specific association, not disabling them all at once.

2

You could delete the CFBundleDocumentTypes array in the Info.plist, but it is also used to define file types like xcodeproj. It would also invalidate the code signature (so you'd have to enter a password to access keychains), and the changes might get overridden by updates. Some applications like TextEdit crash on launch if the Info.plist is modified.

To update the Launch Services database, run /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -R -f /Applications/Application.app/.

You could also unregister the application by running lsregister -u -R -f /Applications/Application.app/, but I don't know if it would get registered again at some point. It would also remove the icons of file types defined by the application.

If you are looking for a faster way to change default applications, take a look at duti. I have published my configuration file (which includes common code and video file types) here.

0

Actually, I don't think you can.

See, OS X make the association by looking into the application's plist file. So you either have to edit that plist file or made changes to the way it detects file type association.

There MIGHT be ways to directly manipulate the database, but it might be too difficult. So try this:

Right click (control-click) on the file belonging to the file type you want to open, and as the contextual menu shows up, hold option. You will see "Always Open With", it won't disassociate, but it will change its priority.

  • I tried this on Yosemite trying to get sublime text 2 to open a source file instead of xcode. sadly it didn't work. Shame, because this would have been convenient and easy to remember. – ThinkBonobo Jun 26 '15 at 1:02
  • 1
    @ThinkBonobo (and all web search arrivals) In Yosemite, you need to Get Info on the file, then select the desired application in the drop-down menu and press "Change All..." in order to get this behavior. "Always open with" only applies to the single file. – reve_etrange Sep 17 '15 at 23:28
  • I had discovered how since but failed to report it. thanks for catching that. – ThinkBonobo Sep 18 '15 at 4:48
0

The only way I can think of doing this is by going to the individual file types and right clicking and going to get info, going down to open with, and clicking the program you want to use and clicking change all.

Another way to do this is by right clicking, and holding option and going to always open and clicking the program you want to use

Hope This Helps

0

Your best option would be to maintain a shell script that sets the default applications for particular file types to whatever apps you prefer. You can then run this any time that things change. This is less destructive than editing Xcode itself, and less time-consuming than changing every file type manually.

See the top answer here for defaults write commands on com.apple.launchservices.secure.plist. You'll need to know the UTI of the file types and the domain name of the app, (e.g. com.mysoft.myapp.)

You must log in to answer this question.

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