How to add TextMate to my PATH on Mac?

My TextMate installation includes Terminal Usage... item in the Help menu, that allows me to install a symlink in a directory of my choice, the default being /usr/local/bin. This seems to be the preferred way to do this, as it is accessible from within TextMate itself.

In TextMate2, the option is located under TextMate » Preferences… » Terminal.


mate is actually a utility that comes with TextMate. It is located at /Applications/TextMate.app/Contents/Resources/mate. The easiest way to add it to your path is to create a symlink to it:

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate

Then add ~/bin to your path by adding the following line in your ~/.profile:

export PATH=$HOME/bin:$PATH

More details can be found in the TextMate Manual. Info such as this:

Mac OS X comes with an open shell command which can be used to simulate a double click from within Terminal. It can also perform an Open With… operation by use of the -a argument, e.g.: open -a TextMate . will open the current folder in TextMate (as a scratch project).

This standard command has a few shortcomings: it can only open one file at a time, it cannot open a document at a specific line and it cannot “stall” the shell until the file has been closed, which is useful e.g. when using an editor to write something like a subversion commit message.

For this reason TextMate comes with its own mate shell command, which supersedes the open command. For usage instructions you can run mate -h (from Terminal).