Here are some possible answers, all using the 'open' command-line utility.
The -a option means "open the file argument with the named application":
open -a TextEdit file.txt
The -e option means "open the file argument with the TextEdit application":
open -e file.txt
The -t option means "open the file with the default application for editing text files, as determined via LaunchServices". By default, this will be /Applications/TextEdit.app; however, it's possible for this setting to get overridden:
open -t file.txt
Finally, any file that's of the "text" type will get opened by the application bound to the text type if you just say open file.txt
. You can use the "file" command to reveal what the operating system thinks the file type is: file file.txt
. So, for example, if you renamed "file.txt" to just "textfile" then open textfile
would still open it in the default text-file editing application, as long as file textfile
still thought that "textfile" was actually a text file.
A short 'help' file on open
can be found by running
open --help
Or you can read the whole manual with
man open
Sorry, but /usr/bin
is still a root/wheel directory, so it is actually going to be worse to install the textwrangler stuff there.
In any case, in your terminal type
echo $PATH
and see if /usr/local/bin
is in the path. If /usr/local/bin
is in your path all the stuff you install there will NOT need root permissions to be run. If it is not, you can add it as such:
go to /etc/paths.d/
create a text file that you can call localstuff (or whatever)
edit localstuff putting /usr/local/bin
in it.
Example:
$ ls /etc/paths.d/
50-X11 MacGPG2 TeX TeXbin git julia
$ cat /etc/paths.d/julia
/usr/local/julia
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/julia:/usr/local/MacGPG2/bin:/usr/texbin:/opt/local/bin:/opt/local/sbin
make sure that your shell is a login shell in whatever terminal you are using, the OSX predicated way of adding stuff to $PATH
seems to break if you do not use a login shell.
As I said though, chances are that /usr/local/bin
is in your user's $PATH
anyway, so no need to worry. I'd also move all the textwrangler files you put in /usr/bin
in /usr/local/bin
to avoid future problems.
Best Answer
As a one-time thing,
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:
To make TextWrangler the default: