I've installed TextMate, BBEdit, and XCode, and I seem to be caught in the crossfire of a file association war. Example: TextMate wants to be the editor for Fortran 90 files (.f90), but BBEdit wants to be the editor for Fortran 77 (.f77) files, and XCode wants to be the editor for plain old Fortran (.for) files. Does that make sense to anyone?
What I'd like to do is remove all of BBEdit's and XCode's associations, thus leaving TextMate as the editor for just about everything (because it's set up to open unassociated files). Is there an easy way to do that? I know of a program called RCDefaultApp that can show the associations for a given app, but there doesn't seem to be a way to do a "bulk unassociation," just one by one. Is there a better way?
Trevor
On Sep 19, 2006, at 10:14 PM, Trevor Harmon wrote:
I've installed TextMate, BBEdit, and XCode, and I seem to be caught in the crossfire of a file association war. Example: TextMate wants to be the editor for Fortran 90 files (.f90), but BBEdit wants to be the editor for Fortran 77 (.f77) files, and XCode wants to be the editor for plain old Fortran (.for) files. Does that make sense to anyone?
What I'd like to do is remove all of BBEdit's and XCode's associations, thus leaving TextMate as the editor for just about everything (because it's set up to open unassociated files). Is there an easy way to do that? I know of a program called RCDefaultApp that can show the associations for a given app, but there doesn't seem to be a way to do a "bulk unassociation," just one by one. Is there a better way?
Why don't you open the Finder, and navigate to one of the f77 files. Then press cmd-I to bring up the info panel. Then, in the Open With option, select TextMate, and then click the button right below called "Change All". Do the same for one of the .for files. That should fix all f70 and for files. So you really should only have to do this only once for every file type.
Trevor
Haris
On Sep 19, 2006, at 7:21 PM, Charilaos Skiadas wrote:
So you really should only have to do this only once for every file type.
"Every file type" is the problem. RCDefaultApp reports that there are about *50* different extensions associated with BBEdit and XCode. I don't want to go through and manually change every one of those mappings. And what happens if I install yet another editor or, say, a new version of BBEdit? I'll have to go back and change all those associations *again*. Surely there's an easier way? I guess I could always resort to writing some AppleScript, assuming that would work...
I suppose I'm also asking the broader question of why apps like TextMate/BBEdit/etc. have to associate themselves with anything to begin with. For example, when I install two C++ editors, they fight for the .cc association, and I guess whichever one is installed last wins. Seems like a rather weak way of managing file associations.
Trevor
On Sep 19, 2006, at 11:09 PM, Trevor Harmon wrote:
I suppose I'm also asking the broader question of why apps like TextMate/BBEdit/etc. have to associate themselves with anything to begin with. For example, when I install two C++ editors, they fight for the .cc association, and I guess whichever one is installed last wins. Seems like a rather weak way of managing file associations.
I'm afraid this will be far from a satisfactory answer, but this is partly the system's fault, it is how Launch Services works. The various programs don't claim an association, they just state their ability to open a particular kind of file. With few notable exceptions, programs won't aggressively try to set themselves as handlers of particular data types, they just tell the system that they can open those data types. The system has been programmed to function in this "last come, last served" kind of way.
I am however relatively ignorant in these matters, so I will shut up for now and let someone with more experience provide a better explanation. For what it's worth, I agree that this system is not ideal.
Trevor
Haris
This discussion made me curious about exactly how this works in OS X. If anyone is curious:
This page[1] at the Apple Developer site describes the sequence of events for determining which application to launch when a document is opened (in a high-level, no-detail sort of way).
I believe that all the extensions applications claim to accept (and thus applications associated with an extension) are generated programatically, and cached here[2]:
/Library/Caches/com.apple.LaunchServices-014nnn.csstore
where nnn is your uid number from the NetInfo database.
This program:
/System/Library/Frameworks/ApplicationServices.framework/ Frameworks/LaunchServices.framework/Support/lsregister
Is capable of rebuilding that cached database and displaying it ("lsregister -dump | less") for you to look at, if you're interested.
I think all of your customizations of preferred applications are stored here:
~/Library/Preferences/com.apple.LaunchServices.plist
I haven't confirmed this for certain, but I imagine that the 'file association war' mostly occurs in this plist. I don't know exactly how this is supposed to be formatted, and perhaps shouldn't be edited by hand, but I'd think it should be pretty easy to go and delete all xml elements which reference applications you *don't* want to be opening files, or perhaps make some minor edits replacing one app reference (the undesired) with another (the desired). Writing some AppleScript (if one knows how to do that, and I don't) might be a safer bet. Although, can't be too dangerous to make a backup copy of the plist and then edit to your hearts content, see what happens.
[1]: http://developer.apple.com/documentation/Carbon/Conceptual/ LaunchServicesConcepts/index.html#//apple_ref/doc/uid/TP30000999 [2]: http://www.thexlab.com/faqs/resetlaunchservices.html
On Sep 19, 2006, at 10:09 PM, Trevor Harmon wrote:
On Sep 19, 2006, at 7:21 PM, Charilaos Skiadas wrote:
So you really should only have to do this only once for every file type.
"Every file type" is the problem. RCDefaultApp reports that there are about *50* different extensions associated with BBEdit and XCode. I don't want to go through and manually change every one of those mappings. And what happens if I install yet another editor or, say, a new version of BBEdit? I'll have to go back and change all those associations *again*. Surely there's an easier way? I guess I could always resort to writing some AppleScript, assuming that would work...
I suppose I'm also asking the broader question of why apps like TextMate/BBEdit/etc. have to associate themselves with anything to begin with. For example, when I install two C++ editors, they fight for the .cc association, and I guess whichever one is installed last wins. Seems like a rather weak way of managing file associations.
Trevor
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- Matt Anderson
On 21/9/2006, at 16:54, Matthew Anderson wrote:
This discussion made me curious about exactly how this works in OS X. If anyone is curious: [...]
Thanks -- I wanted to write up something on the blog, because I occasionally actually get what could be called hate mail regarding this plus I have a one-star rating on version tracker with this as the reason.
[...] I think all of your customizations of preferred applications are stored here:
~/Library/Preferences/com.apple.LaunchServices.plist
I haven't confirmed this for certain, but I imagine that the 'file association war' mostly occurs in this plist
It does keep your customizations, yes. The problem however is, that generally users have no customizations, and that is when the problem arise.
If e.g. you install SubEthaEdit, and it says it can open cc files, the system will check if there is any hardwired binding for cc files, as there isn’t, it will see which apps can open cc files, if none are “apple default”, then it will randomly pick one.
Seeing how the user only has SEE to open cc files, that’s all fine, he gets SEE to open all his various text files.
Then one day he decides to try out TM, now there are suddenly two apps which can open cc files, and if both are in /Applications, the system appears to randomly pick one of them [1], so 50% of the time, the system will now open all the users files with TM instead of SEE, and the user will think that this is the doing of TM.
[1] It might actually be, that the system picks the newest one, logically that wouldn’t be a bad assumption, that the newest app which can handle a document type, is the one the user wants to use for that document type -- but for people trying out new software, it would almost always be a bad heuristic.
On Sep 21, 2006, at 11:08 AM, Allan Odgaard wrote:
[1] It might actually be, that the system picks the newest one, logically that wouldn’t be a bad assumption, that the newest app which can handle a document type, is the one the user wants to use for that document type -- but for people trying out new software, it would almost always be a bad heuristic.
I believe it is a FILO stack - so the newest does take precedence (though I've done zero research to back it up), though I believe the document creator code and file type flags are more heavily weighted than document extensions.
I generally avoid the file association war entirely, and do one of two things when opening documents for which I have more than one editor:
1) open from within the app 2) drag & drop - drag the document icon to the app icon. (the latter is the one I use most often).
Frankly, I think file associations will always be problematic for non- proprietary documents (regardless of platform), but a usable interface for the LaunchServices database would be nice to have.