* On 4/19/19 11:25 PM, Helmut K. C. Tessarek wrote: > I want to dissociate the file extension .md from any application. > After installing Xcode, the .md extension is associated with Xcode. > Yes, I can change the association to a different application, but I > don't want an association at all. > I want macOS to let me choose the app every time I double click on an > .md file. > > Therefore I have this simple question: > > How do I dissociate a file extension from an application?
Guess what? You can. Once. Not easily, though. You COULD delete or modify ~/Library/Preferences/com.apple.LaunchServices.plist, but that would only help for associations you made/changed yourself. The issue that Xcode's Info.plist file includes MIME type, URI and file extension specifications that are being registered with... whatever it is, LaunchServices probably. There's no way of turning off auto-discovery of such metadata, it seems. To truly get rid of these associations, you'll have to edit Xcode's Info.plist file and remove them manually. Xcode brings a plist editor, so the binary format isn't a huge issue - however, the first hurdle would be file permissions. You'd probably be better off copying its Info.plist file to your home directory and edit it there. When done, move it back, but make sure that the file permissions exactly match the original state. I'd say that you need to remove the CFBundleTypeExtensions entry for "md". Afterwards, regenerate the database via /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user and give Finder a nudge using killall Finder. Note that this won't solve your general problem. It may unlink Xcode from the file extension (at least until you update the Xcode installation, which will bring the automatic association back of course), but once you open it with some other application, this new preference will be automatically saved in the file I mentioned at the beginning. Of course there is no way to prevent that from happening. Like Ryan said, there's no built-in way to achieve what you want to do. There are applications like Choosy or Finicky (latter has source code available), but they only handle URLs. It might be possible to extend the latter one to work on MIME types/file extensions as well, but is it worth the effort? Mihai
signature.asc
Description: OpenPGP digital signature