Naming your Terminal tabs in OSX Lion

If you find yourself in the Terminal app with a bunch of tabs open, the default name of “bash” isn’t very useful when navigating between them. You can change the tab name via the UI by right clicking the tab, then clicking “Inspect Tab” and changing the window or tab names but this is somewhat long winded.
Below are a couple of bash functions I have in my “.profile” file to make this easier:

function tabname {
  printf "\e]1;$1\a"
function winname {
  printf "\e]2;$1\a"

Now you can easily name your tabs or windows with the following:

# Rename tab
tabname "Funky Tab"
# Rename window
winname "Funky Window"

Thanks to Bubu and Chris Page on the SuperUser site for the right codes.

TextMate refusing to launch in Lion

On occasion under OSX Lion, TextMate refuses to launch. I’ve found that simply deleting it’s pid file seems to get things working again, just open Terminal and type:
rm ~/Library/Application\ Support/TextMate/
Hope this safes someone some puzzled frowning time.