Open file via TextEdit program in Mac OS Terminal

· · 192 words · 1 minute read

Using open command doesn’t fulfil this job. So we need to use another command.

We can use open -a TextEdit filename.ext for example open -a TextEdit pin.svg. This command will open the file in TextEdit program in Mac OS.

We can use another flag with the open command to achieve the same goal. The command is open -e filename so we can use open -e /Users/mbp/Desktop/work/VectorAndClipart/pin.svg to open the pin.svg file in the Mac OS graphical text editor TextEdit.

You can simplify the command by creating a shortcut (or alias) for it. Just use alias textedit="open -a TextEdit" or alias textedit="open -e", then you can use open the file in TextEdit by this new command textedit filename.ext.

If you are using FISH shell, just create an abbreviation like this abbr textedit open -e or abbr textedit open -a TextEdit. Then, you can use textedit and after clicking on the spacebar the real command will appear, and you complete the command by adding the file name from current directory, or full file path.

I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.

Share: