MacOS – Choose a default app for opening files with no extension

findermacosuti

Is it possible to set a default application to open files with no extension? I'm not referring to files with hidden extensions, but those completely lacking an extension — e.g. README, CHANGELOG, mbox, etc.

"Open With" => "Change All" on these files doesn't work, returning the error shown below:

Open With / Change All -- Fail

Ideally, I would like the system to try opening all such files in TextMate. I know I can drag files onto Dock icons to open them in specific apps, but I'm looking for a more seamless solution than that (especially since I have my Dock auto-hide, which makes it much more cumbersome).

I am familiar with the QLStephen QuickLook plugin that can enable QuickLook for some of these files, but I would prefer a solution with selecting/copying/editing capabilities.

Best Answer

You can add a default application for public.plain-text in ~/Library/Preferences/com.apple.LaunchServices.plist.

defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.apple.textedit;}' '{LSHandlerContentType=public.unix-executable;LSHandlerRoleAll=com.apple.textedit;}'

Restart to apply the changes (logging out and back in isn't enough).

I've added this to a duti configuration file:

com.apple.textedit public.plain-text all
com.macromates.textmate public.unix-executable all