Launch OS X Terminal With Specific Settings From Command Line
Back when I did most of my development using Linux, I would often create scripts that would launch xterms with specific settings and colors to "color code" my development environment. A particular terminal connected to a host might be blue, to give me a strong visual cue what environment I was typing commands in.
An old tip that I find useful (especially when you're sleep deprived) is to color code a terminal connected to an important (say, live) site in a warning color like red or yellow. I find it makes it less likely you'll do the inevitable fumbly-finger destructive command by accident (
DROP TABLE important_stuff, or
rm * in some critical live site path).
I decided I wanted to recreate something similar in OS X and it took me a few searches to find a solution so I thought I'd share. This is in OS X Snow Leopard, so YMMV.
First create your Terminal settings using the Inspector in the Terminal app. Select your colors, initial command, fonts, size, etc... Then launch a terminal with those settings. Select
Shell » Export Settings... and chose a filename. This will save an apple .plist, XML file with a
.terminal extension. You can also use the "Gear" icon on the Inspector settings panel and chose
Export... to do the same thing.
Since it's just an XML file you can use a text editor and edit this file to change the settings if you want. There are two nice things that you can do with this file, first you can double click on it to launch a terminal with those particular terminal settings. The other thing is that now you can write scripts to open those particular terminal settings using the open command, just call the .terminal file like so:
open ~/Desktop/my_red_warning_terminal.terminal. Voila.