Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
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?
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.
- Go to any file whose extension you don’t want to open with Xcode (e.g.
- Right click on it, select
Get Info(or CMD I).
Open With, select your editor for that extension.
Change Allto 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.
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.
xcode-select --install in terminal to get the CLI. This solves Xcode dependency for (eg.) Homebrew and you can subsequently forget about Xcode.
The other answers didn’t help me, because I still need the GUI of Xcode. Therefore, here is a different approach:
You can use SwiftDefaultApps to override the default apps. You can find it on GitHub: https://github.com/Lord-Kamina/SwiftDefaultApps
After the installation you will find in the system preferences the new item SwiftDefaultApps. In the tab “Uniform Type Identifiers” you can change the editor for the type “public.php-script”. You can even overwrite the viewer for the preview.
duti will help, check this Set vscode as the default for text files on mac
brew install duti duti -s com.microsoft.VSCode public.json all duti -s com.microsoft.VSCode public.plain-text all duti -s com.microsoft.VSCode public.python-script all duti -s com.microsoft.VSCode public.shell-script all duti -s com.microsoft.VSCode public.source-code all duti -s com.microsoft.VSCode public.text all duti -s com.microsoft.VSCode public.unix-executable all duti -s com.microsoft.VSCode .md all
I had the same problem, but worse, where ‘Always Open With’ kept being ignored!
I fixed like so (source):
click once on the file in Finder
choose File -> Get info (or Apple+I)
select the application you want to open that file under “Open with”
click on “Change All…” to apply this globally
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged .