MacOS – Adding TextWrangler to the path environment

macbook promacospath

I would like to add TextWrangler to the path environment. I have tried with this command on the terminal:

alias textwrangler=/Applications/TextWrangler.app

and then tried to call it just typing textwrangler, but as you can imagine, it's not working.

I did it in this way, because I had done the same thing for mysql, and it had worked.

I know there are other possibilities to add an application to the path environment, but I would like to know what is the secure way to do it. Can you describe it?

By the way, what I did, as I understood, is not exactly adding TextWrangler to the path environment…

Best Answer

Your alias which you have configured will change the working directory in shells which support changing directory without 'cd' to the application bundle of TextWrangler.

To have an alias which opens an app, you will need to run the binary in the app bundle, usually located in Contents/MacOS. For example…

alias textwrangler=/Applications/TextWrangler.app/Contents/MacOS/TextWrangler

The binary in TextWrangler also understands arguments for passing files, which will mean that you can now edit files using the following. This won't work with every app though.

textwrangler /path/to/file

I'm not sure I understand what you're trying to add to your path, but if you want to add the binary to your path, you can add the containing folder:

export PATH=$PATH:/Applications/TextWrangler.app/Contents/MacOS

To add the alias to every interactive shell session, add the alias line to one of the profile files for your shell.