TextMate will not launch

I have had some problems with TextMate, but I did not know when it started. Probably since my last reboot (which would in fact be a correct guess) but since I do not reboot my mac very often I have no idea when it really started. I thought it had something to do with some zombie process, some socket that stalled, or something like that.

I was almost correct.

After looking carefully at what happens at boot, looking around on the net etc, I found that TextMate has a file where it keeps track of the process id of itself. If the mac crashes in such a way that the file with this status is not removed, TextMate will not boot if the PID in this file happens to be used, but not for TextMate. It simply believes itself is already running. Etc.

The file is the following:

~/Library/Application Support/TextMate/TextMate.pid

If this file exists, and TextMate is not running, you can safely remove it1. After removing it you will be able to launch TextMate again.

1. Note that the path do have a space in its name, a space that must be quoted if you remove the file on the command line.