How can I open a text file with TextWrangler from the Terminal (command line)?
Solution 1:
As a one-time thing,
open -a /Applications/TextWrangler.app myfile.txt
open -b com.barebones.textwrangler myfile.txt # same thing by ID
You can also create an alias
for opening TextWrangler, that you would put on the .bash_profile
file, which is an hidden file by default that is usually in your home directory.
This is the command that you could insert:
# Type 'tw' on the terminal to open TextWrangler
alias tw='open -a /Applications/TextWrangler.app'
To make TextWrangler the default:
- "Get Info" on a text file in the Finder.
- Change the "Open with:" program to TextWrangler, in the fifth information pane.
- Click the "Change All..." button at the bottom of the pane.
Solution 2:
If you have the TextWrangler command line tools installed, you can just type
edit my_text_file.txt
in the terminal and it should open.
If this doesn't work you have to install the TextWrangler command line tools.
If you installed the MacApp store version, download the installer from this page: http://www.barebones.com/support/textwrangler/cmd-line-tools.html
If you downloaded from the BareBones Software site, there should be an "install command line tools" command in either the Application (TextWrangler) menu or the help menu. I think it's in the Text Wrangler menu.