How to change the default opening application for a file created by touch? 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?
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.