I create a file by touch myFile in the Terminal.

When I open this file in the Finder, it opens with TextEdit. But TextEdit is not ok for me, because it automatically transforms the character ' into , which is not satisfactory for coding.

Thus, I want to always open these files with Sublime for instance.

But, when I CMD+I this file to change the default opening application for such files, I get an error message.

Is there a way around?

  • What error message?
    – napcae
    Feb 8, 2014 at 11:04
  • This one (see my edit).
    – Colas
    Feb 8, 2014 at 15:51

1 Answer 1


Are you appending a file type when you create it, or is it truly "myFile" and not "myFile.txt" or similar? You can't set a default program for a file with no set type. For any other file type, you should be able to change the default program.

Not a fix, but a workaround: open -a SublimeText myFile to open it in the program you specify, rather than the default program set for that file type. You can also control-click on files in Finder and use "Open With" or just drag the file directly onto the app icon in the Dock to do it faster.

  • There is no type. But, the file is opened automatically with TextEdit. On the contrary, for some files, the Finder does not open at all ("this file is not recognized")
    – Colas
    Feb 8, 2014 at 15:54
  • 1
    Weird. Wondered if the file contents had anything to do with how the system handles the document. I just created a zero-byte, no extension, empty file in Terminal using Touch, it shows as a "Document" and automatically opens with my default text editor (Textwrangler) when I issue "Open" command from Terminal. But Get Info shows that "TextEdit" is the default program to open these files. So it isn't necessarily guessing based on file content, either.
    – dr.nixon
    Feb 10, 2014 at 19:28
  • How do you set "your default text editor"? On a .txt file?
    – Colas
    Feb 10, 2014 at 20:29
  • I believe I must have done that at some point. Probably changed all, as I was tired of TextEdit popping up instead. TextWrangler also has command line tools, which I installed; not sure if they change the default "open" response but if I type "edit (name of file)" in Terminal, it opens in TextWrangler.
    – dr.nixon
    Feb 11, 2014 at 22:36

You must log in to answer this question.

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