1

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 > Keyboard > Shortcuts > Services > Files&Folders > 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 -> Open with -> Other -> "tex"-> (click TextEdit) -> check "Always open with..." -> 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?

  • 1
    I keep a copy of Text Edit in my Dock; then whenever I want to open a file in Text Edit, I drag its icon onto the Text Edit icon in the Dock. – GEdgar Jan 15 '14 at 20:29
  • All the answers seem to be workarounds and are overlooking the basic problem which is that TextEdit is being regarded as from an unidentified developer. Since it's built-to the OSX distribution surely it should be considered a trusted application? – Andy Sep 24 '14 at 16:36
2

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.

1

This may be your problem:

http://osxdaily.com/2012/07/27/app-cant-be-opened-because-it-is-from-an-unidentified-developer/

P.S.: I am lazy and do not want to type so I have referred you to a page that already contains everything I would have typed.

  • After fixing the unidentified developer problem, you can do the right click on the file -> Open with -> Other -> "tex"-> (click TextEdit) -> check "Always open with..." -> Open and it should work properly – Chris Mukherjee Jan 15 '14 at 22:51
1

When you right click on the file in the Finder and select 'Open With` you should get a long list of options on any text file that includes Sublime Text if it is installed.

If you don't then there is a problem with either the file type (does it say 'Plain Text' or 'Python script` or similar as the file type?) or the Launch Services database.

Try rebuilding the Launch Services database with this command :

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\ LaunchServices.framework/Versions/A/Support/\ lsregister -kill -r -domain local -domain user

from the command line. It might take a while. Then restart the Finder with killall Finder.

As for opening files from the command line most decent editors designed for programming have a command line tool, Sublime Text 2 included. See the documentation here for all the details on how to set it up.

You must log in to answer this question.

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