Edit contents of file from Finder with text editor As a developer I need to constantly be examining/editing the contents of text files, and opening them from Finder and the command line.

I would like to right click the file in finder, and have the menu option "Open with Sublime Text Editor" or at least TextEdit!

There even seems to be the option to do this at least with the default TextEdit in Mavericks:

System Preferences &gt; Keyboard &gt; Shortcuts &gt; Services &gt; Files&amp;Folders &gt; Open Selected Files in TextEdit


But if I check that, nothing happens!  As opposed to "new terminal at folder" which DOES work.

Instead I:

right click on the file -&gt; Open with -&gt; Other -&gt; "tex"-&gt; (click TextEdit) -&gt; check "Always open with..." -&gt; Open


And...

'foo.bar can't be opened because it is from an unidentified developer.'


WHAT? All that work for nothing!

Instead I have to launch TextEdit, and open the file.

The command line is no fun either; using vim / emacs is horrible; I don't want any editor where I have to remember some obscure keyboard shortcut to even get back to my terminal prompt.

So how do I achieve a decent workflow as a developer?
The "foo.bar can't be opened because it is from an unidentified developer" error is because of Gatekeeper. You can disable Gatekeeper from System Preferences:



Selecting "Always Open With" from the "Open With > Other..." dialog only changes the default application for the selected files. You can change the default application for all files of a type from a Show Info window:



You can add a context menu item for opening files in TextEdit by creating a service like this with Automator:



If you have the Powerpack for Alfred 2, you can also create a workflow like this:



You can use duti to make TextEdit the default application for plain text files without an extension and executable scripts. Install Homebrew, run brew install duti, save

com.apple.TextEdit public.plain-text all
com.apple.TextEdit public.unix-executable all


as ~/.duti, and then run /usr/local/bin/duti ~/.duti.