Creating an empty txt file on Mac OS without opening an application first

Bernd picture Bernd · Jan 6, 2010 · Viewed 64.3k times · Source

Is there a way to simply create a new document e.g. on the Desktop and open it with e.g. textmate with a simple shortcut or script. I know that the MS Windows approach where you can just create a new empty txt file directly is not working for Mac. I am looking for a method achieving something similar. Any ideas?

Answer

Emil Vikström picture Emil Vikström · Jan 6, 2010

You can write this in the terminal:

touch filename.txt

Or as a script:

#!/bin/sh
touch filename.txt