I typically associate certain file types with certain editors and IDEs. You know R with RStudio, Java with JetBrains, and all the other goodies with Sublime Text.

But every time I install an Xcode update, Xcode takes over every code-related extension imaginable, and I have to associate my files manually.

Is there anyway to prevent Xcode from taking over my file associations?

  • 5
    ^^THIS. The best workaround I've found is to never install the sodding GUI. Use xcode-select --install in terminal Feb 7 '20 at 15:32
  • We might be able to edit xcode's Info.plist file to remove any CFBundleTypeExtensions that we don't want. (article) But it might get wiped every time xcode updates :/ Leaving as a comment in case this turns out useful but I haven't been able to try it yet.
    – mrgnw
    Apr 13 '20 at 15:01
  • I hope someone find a reliable answer to this, once terminal command to fix all.
    – sorin
    Jun 10 '20 at 8:01

Absolutely there is!
Unfortunately because Xcode is installed through the Mac App Store, we are unable to control / prevent the change from occurring in the first place. The automated installation takes care of that for us.

How to Change the Default Programs
Luckily there is an easy fix to resolving the issue and reversing the change. The only caveat of which is the fact that this is done on an extension-based level.

  1. Go to any file whose extension you don't want to open with Xcode (e.g. my file.java).
  2. Right click on it, select Get Info (or CMD I).
  3. Under Open With, select your editor for that extension.
  4. Click Change All to make the change global across all files of this type.

I believe some IDEs or even individual Text editors will ask if you would like to associate them with the most common formats for software development - with Xcode that's a little less optional. Anyway, hope that helps, let me know if it did and how you make out. I'd be interested in following up with you on this.

  • 7
    I already know that I can change the extensions manually... that's how I did it in the first place. I just don't want Xcode to be able to hijack my file associations on every update.
    – fny
    Mar 1 '18 at 4:13
  • 1
    @fny Were you able to make any progress on this? I feel that at this point my answer is the only way to resolve the extension hijacking so I am also keen to know if you have found alternative solution in the meantime.
    – ProGrammer
    Mar 9 '18 at 10:06
  • 1
    Nope haven't had time to figure anything out!
    – fny
    Mar 13 '18 at 0:46
  • OSX is broken.. thank you!
    – Adam F
    Feb 10 '20 at 20:35
  • I love how no one ever reads these questions properly (of which there are numerous examples on the web) and says "just use the 'change all' option", not realising that that is exactly what people HAVE been doing....if it worked, why would they still be asking the question?! ;-) Jan 25 at 16:38

The best workaround I've found is to install the Xcode CLI and NEVER INSTALL the Xcode GUI. As OP says, the GUI/IDE aggressively accrues responsibilities and I never worked out how to stop it.

Use xcode-select --install in terminal to get the CLI. This solves Xcode dependency for (eg.) Homebrew and you can subsequently forget about Xcode.

You must log in to answer this question.

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