Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

You can do this using Magic Launch. After installing, you can create rules to launch based on various criteria. You need to create a rule for text apps where the extension is blank. You can set up more complex logic if you need it.

http://michelf.com/software/magic-launch/

share|improve this answer
    
You're right -- I had to create a custom rule to handle files with blank extensions...but it seems to have worked -- thanks! The only downside is that it's $13. I have no problem paying for good apps, but that's a bit steep considering I'm looking for just this one feature. –  Austin May 7 '11 at 4:07

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
share|improve this answer
2  
This looks like a good one, more details of what is going on here at a top-level would be nice. An intro, what is going on in step 1, etc. –  MrDaniel Aug 13 '12 at 19:22

Take a look at RCDefaultApp (freeware).

RCDefaultApp is a Mac OS X 10.2 or higher preference pane that allows a user to set the default application used for various URL schemes, file extensions, file types, MIME types, and Uniform Type Identifiers (or UTIs; MacOS 10.4 only).

share|improve this answer
    
I like that it's free, but there's no way to set a default app for files with no extension. Using MIME types can approximate this somewhat, but then it changes the default app of all text files, not just those with no extension. Thanks for the suggestion anyway -- perhaps it will help someone else. –  Austin May 7 '11 at 4:07

A bit late this, the question "How to avoid typeless files opening in terminal" being a bit old. However:

The solutions above involve changing the existing rules, which can have unwanted side-effects. I find the easiest is to exploit the existing rules for typeless files and changing file permissions to get the result I want.

Specifically: Switch off the executable bit on the file, because that's what's telling file service to open with terminal with "chmod -x filename" where filename is ... the filename.

This can be automated to some extent (with caution): In my case, I have a lot of README files on a machine. I can use "find" to find all "README" files. And then use "awk" to construct a command to remove the executable bit on all of them as follows:

find /$HOME -iname 'README' | awk '{ print "chmod -x " $0 }'

type that into the terminal if you want to check what files will be changed: The output will consist of a listing for each README found looking something like this:

chmod -x //Users/jimpsmith/things/README

And to change all those permissions execute all these lines by feeing them to bash as follows:

find /$HOME -iname 'README' | awk '{ print "chmod -x " $0 }' | bash

Just beware of using wildcards too liberally and finding you're accidentally removed the executable bit from some executables that erroneously match.


An easier way would be to just run

find /$HOME -iname 'README' -exec chmod -x '{}' \;`

or (to see what would happen)

find /$HOME -iname 'README' -exec echo chmod -x '{}' \;`
share|improve this answer
1  
I somehow fail to understand how this solves the problem stated in the question. README, ChangeLog etc. usually don't have the x bit set to start with anyway. The problem is that OS X relies on suffixes to identify the application to open file with and these files don't have a suffix. –  patrix Dec 1 '12 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.