Managing OS X Terminal Windows Groups

I prefer OS X's stock Terminal app to iTerm 2 because it automatically reopens and restores previous terminal windows and tabs and keeps the scrollback for each tab (although bash history is lost per tab, reasonable since bash is a separate program from Terminal). iTerm2 used to be a much better Terminal but Terminal has gotten better and is more than usable now. iTerm2 does have some cool features like instant replay/rewind, better support for the mouse for vim. [Note: xterm is also available on stock Mac OS X.]

Besides restoring, you can save your windows and tabs as a 'Windows Group' in Terminal. To do this, go to the menu: Window -> Save Windows as Group. This saves internally.

Now, if you want to be a hacker, you can edit these settings manually, or save copies somewhere for later. The settings are saved in a plist and the location is: ~/Library/Preferences/

To edit a plist file, you can install Prefs Editor, a recommended free tool to view and modify OS X Plist files. Inside Prefs Editor you just search for and you can tweak the plist settings and save them without accidently corrupting the file like you might in a normal text editor even though it's just xml.

If you want to manipulate the plist file in code, there are a few options. The 'plutil' command can convert a plist file to json for manipulation in most programming languages: plutil -convert json example.plist. There's also the plist-to-json package for Node.js.

You can save your Terminal window groups, tweak them in Prefs Editor, hack them via Node.js, and save revisions of them in git.