› All Posts › programming › Open file via TextEdit program in Mac OS Terminal

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.

Abanoub Hanna
Author

Abanoub Hanna

Software developer and founder of KartBusiness

The author is Abanoub Hanna, a graduate of the Faculty of Science, Department of Microbiology and Biochemistry - Sohag University. I work in the software development industry. Founder of the KartBusiness platform, and developer of the Keme PDF app , Keme POS app , Keme Cash app , img2txt OCR app , Agpeya app , Pope Shenouda III Books app , and Keme OCR Text Scanner app , as well as the owner of the Abanoub Hanna website.