2

I want to open all makefiles with TextWrangler. But since makefiles have no suffix so binding a type of file to TextWrangler does not work.

How can I tell Mac to open any file named Makefile with TextWrangler?

1

There is no way to do this, you can change the application opened on a per instance basis using the standard methods, however this will not apply to all other files of the same name.

There are two workarounds, but those do involve a slightly more user movements, click->mouse move ->click) instead of double-click

  1. TextWrangler adds an menu item to the right click (ctrl-left click) menu for all files to "Open File in TextWrangler"
  2. Drag the files into the TextWrangler app (or a shortcut) to open the files directly.
1

I don't know any way to change the default app based on filename, but you could assign a default application for text files with no extension (and executable shell scripts). f=~/Library/Preferences/com.apple.launchservices.plist; plutil -convert xml1 $f; open $f -a TextEdit and add the entries below to the LSHandlers array:

<dict>
    <key>LSHandlerContentType</key>
    <string>public.plain-text</string>
    <key>LSHandlerRoleAll</key>
    <string>com.barebones.textwrangler</string>
</dict>
<dict>
    <key>LSHandlerContentType</key>
    <string>public.unix-executable</string>
    <key>LSHandlerRoleAll</key>
    <string>com.barebones.textwrangler</string>
</dict>

Applying the changes requires restarting the OS (not just logging out and back in).

0

There is a way, but I wonder if LaunchSerivces would honor it on Lion or not.

Any how, it is setting the file's creator & type code.

I read some time ago that Lion's LaunchServices no longer honors those codes and they are Legacy tech from the old Mac days.

I can think of one possible solution for this. That is to change, if that is even possible, the kMDItemContentType to have a type unique to Makefile's. Also that type must be some how constructed and listed in the field below that which is kMDItemContentTypeTree. You can lookup those fields while running % mdls Makefile in Terminal.app.

Either way, setting the creator & type codes or setting kMDItemContentType field, is not an easy task. But I hope I have put you on the right track for a possible solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .