Installing TextWrangler command line tools into /usr/bin

terminaltext-editor

I just installed the text wrangler command line tools and they are placed into /usr/local/bin by default. On Lion this directory appears to be a root only directory, and I don't want to have to run the edit command as root.

However if I copy the edit command into /usr/local it won't launch textwrangler. I can see the "edit" process running but text wranger isn't launched.

Is there a trick to getting edit working in /usr/bin? The other command line tools from textwrangler work fine from there.

Best Answer

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.