default application for unrecognised filetypes

frey

Registered
Hey there

Is there any way to launch a default application when I try to open an unrecognised file type?

On Windows I had it set up so that if I double-clicked on an unrecognised file type it would open it up in a good text editor (this was a registry hack). How do I do something like this on my new Mac?

Also, can I make my Mac remember my Open With applications? I sometimes want to open .js files with a text editor rather than with Safari (the default) - it's a pain having to go through the whole Open With->Other->locate the text editor steps, I'd prefer the text editor to live on the Open With menu by default.
 
Drag & Drop works.

But drag and drop is still more of a pain than just double-clicking and opening in a text editor by default. I'm a programmer, I like to see the contents of random files, and I like to do so often, and I don't like using the mouse so much.
 
But drag and drop is still more of a pain than just double-clicking and opening in a text editor by default. I'm a programmer, I like to see the contents of random files, and I like to do so often, and I don't like using the mouse so much.
In order to get what you want, you are going to have to do some work. As a programmer, you know this already.
 
Yeah, I do. Problem is I have no idea how to even begin, which is why I'm asking here. Should I be looking for some obscure preferences, or is there a file somewhere I can edit, and if so, where? Or am I going to have to write my own context-menu plugin? Can you even write context-menu plugins on OSX? and if so, how do you apply them to all unrecognised files, rather than specific file types?
 
You already have a contextual menu that gives you an Open With item. Clicking on that gives you a variety of apps that OS X thinks is a likely match. If you prefer another app, choose Other... and browse to your desired app. Likely that you wouldn't need to do that too often. If you have a normal doc that you open, you can set all like documents to open with the app of your choosing in Get Info for that file.

I prefer drag-n-drop, as you will immediately know if the app will even try to open your file, then quickly move to a different possible app. I have a folder on the desktop with aliases for a variety of video apps. Takes 2 seconds to drag a potential file to the various apps. If the app doesn't highlight, then I move on. Easy to rule out a couple of dozen choices in one mouse-rollover.
 
Also, can I make my Mac remember my Open With applications? I sometimes want to open .js files with a text editor rather than with Safari (the default) - it's a pain having to go through the whole Open With->Other->locate the text editor steps, I'd prefer the text editor to live on the Open With menu by default.

Yes. Select the file and go to File > Get Info. Set your preferred app there, and your selection will stick for that file. You can also set that app to be the default for all files of that same type.

As a shortcut to making your selection stick for the one file, you can hold down the Option key while using the contextual menu. That will change "Open with" to "Always open with".

I'm not aware of any way to set a catch-all for unknown file types. I've never really looked for one, though, so that doesn't mean there is no way. If you're itching to hack your way to a solution, I recommend starting your quest with ~/Library/Preferences/com.apple.LaunchServices.plist. RCDefaultApp could also prove useful.
 
Back
Top