How To add “Open folder in Textmate” to Finder Context Menu

I wanted to add a menu item in Finder’s context menu that would open the selected folder in Textmate.
Textmate context menu item: Open selected folder in  Textmate

A google search suggested the method described by K. Adam Christensen on his blog: “Opening a directory in TextMate from Finder“. However, from the documentation, I learned that that method is now outdated. Snow Leopard users should use “Services” and not “workflow” for setting this up.

Here is what I did:

Open Automator.app.

From the menu item “File” > “New” choose “Services”

Automator-File-New-Service

Now there are 3 steps to be filled out like so:

Automator final setup for "open in textmate" Finder.app context menu itm
First, edit the top so that “Service recieves selected: files or folders in Finder.app“.

Second, add the action “Get Selected Finder Items” from the left column (use the search field to find, then drag selected into the right work area).

Third, add the action “Run Shell Script” to your service. Fill in the following command:

cat | xargs mate

Finally, choose “File” > “Save…” and give it a name like “Open in Textmate”

4 Responses to “How To add “Open folder in Textmate” to Finder Context Menu”

  1. Joe Alba Says:

    Great tip! I’ve been looking for this feature for a while now.

    But for some reason, it isn’t working for me. I followed the steps, but this service does not appear when I right-click a folder.

    I checked my ~/Library/Services folder, and the service I created was saved as ‘Open in TextMate.workflow’

    Got any tips that could help me out? Does your service wind up with the .workflow extension also?

    (I’m running Snow Leopard — upgraded from Leopard, not a fresh install.)

  2. Daniel Says:

    Nice tip, but somehow the folder or file I selected in Finder appears twice in the Textmate drawer. Do you have the same problem?

  3. Jesper Rønn-Jensen Says:

    @Daniel. Actually yes I have the same problem. Please let me know if you come up with a fix !

  4. Barbara Hofmeister Says:

    Google is most popular and the fastest search engine. adding this kind of facilities will increase its popularity.

Leave a Reply