How to set the Mac OS X Terminal title | Mac Terminal titlebar

I like to set the title (titlebar) on the Mac OS X Terminal application so I can tell one tab from another. For instance, I may have the Play Framework running in one tab, SBT in another, Git in another, etc. Setting the title on each Terminal tab makes my life a little easier.

To set the Terminal title, I use a script I’ve named settitle:

#!/bin/sh

# settitle: set the Mac Terminal title
# usage:    to set the titlebar to 'PLAY', type:  settitle PLAY

echo "\033]0;${1}\007\c"

This lets me set the Terminal titlebar like this:

$ settitle PLAY

and this:

$ settitle GIT

I typically use all-caps to make the titles stand out, but do whatever you like best.

The important part of this post is knowing about the magic echo command. You can also use AppleScript to achieve the same effect, but using echo is easier.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.