How to Associate TextMate With CoffeeScript Files

First, tell OS X to use when you try to open .coffee files. The command below will do just that.

$ defaults write LSHandlers -array-add \

To associate TextMate's generic document icon with .coffee files first go to /Applications/ and open Info.plist. At the bottom of the file there's a section that looks like this:

{   CFBundleTypeName = "Source";        /* generic source code types */
    CFBundleTypeExtensions = (
        coffee, g, vss, d, e, gri, inf, mel, build, re,
        textmate, fxscript, lgt
    CFBundleTypeIconFile = TMDocument;
    CFBundleTypeRole = Editor;

Put coffee inside the CFBundleTypeExtensions listing (as you can see above). Now rebuild the LaunchServices database:

$ ln -s /System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister /usr/local/bin/lsregister
$ lsregister -kill -r -domain local -domain system -domain user

That should be all.