Opening Files and Folders in Textmate 2 From Finder

In case it’s ever useful to anyone else, here’s how to right-click open any number of files and folders in Textmate 2 from the OSX Finder:

  1. Make sure you’ve installed the Shell support, in Textmate 2’s Preferences / Terminal
  2. Open the Automator app and create a new Service.
  3. Locate and add two actions: “Get Selected Finder Items” and “Run Shell Script”.
  4. Configure the Service so it receives selected “files or folders” in “”. And make the shell run the following:
while read file; do /usr/local/bin/mate "$file"; done

Screenshot of the Service:


Finally, save the Service as “Open in Textmate”. You’ll now be able to right-click (or command-click) open files and folders in Textmate 2 from Finder — including hairy ones with spaces in their name.