Open File With App From MacOS Terminal

Sometimes I like to open up a text file in a robust gui text editor on my mac while I am working in the terminal. Navigating to the same location in finder and then opening the file is just a pain. So after a little googling I discovered the open command. Here’s an example of when I need to edit my known_hosts file.

sudo open -a TextWrangler /Users/myuser/.ssh/known_hosts

This example used the -a switch to specify a specific application to open the file with. You can also let MacOS use the default app instead.


Leave a Reply

Your email address will not be published. Required fields are marked *