Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Every morning I launch the OS X app Terminal and tediously set up a bunch of tabs...

  • A ssh session to a certain server ($ ssh ...)
  • A script/console session for the Rails app I'm working on ($ cd myapp ; script/console)
  • An autotest session ($ cd myapp ; autotest)

And a few others.

Is there some way I can arrange it so that these tabs and sessions start automatically when I launch Terminal?

(I can't just leave the machine running because it's a laptop and I carry it around here and there.)

share|improve this question
add comment

2 Answers 2

up vote 10 down vote accepted

Go to Terminal's Preferences and create terminal settings for each tab that you want. You'll see a bunch of default configurations already listed (basic, grass, etc); modify those or create your own to set any colors you want for each tab/window. Then go to the shell tab and fill out the Run command box with ssh ... or whichever command you want.

Then open up the tabs and arrange them however you want them to be at startup. Then go to Window >> Save Windows As Group, and check the box to use them when Terminal starts.

share|improve this answer
    
Much better answer than mine. –  Jack M. Jul 28 '09 at 17:29
add comment

As of Mac OS X Lion 10.7, Terminal makes this a little simpler:

If you create a terminal with Shell > New Command or Shell > New Remote Connection, then create a Window Group, there's a new checkbox to tell it to "restore all commands" as well. So you no longer have to customize settings profiles just to specify a command to run.

(These menu items always create windows. You can View > Show Tab Bar if necessary, then drag them together to arrange them as tabs in the same window.)

In fact, it will automatically restore (re-run) a small set of common "safe"† commands: anything listed in /etc/shells, screen, tmux, emacs, vi/vim, nano, pico, top, and sessions created with New Remote Connection (ssh, etc.).

Moreover, Terminal supports Lion's Resume: It will automatically restore open windows (including "safe" commands) if you quit and restart Terminal, without having to create a Window Group. (To get Resume to restore other commands, use custom settings profiles to specify commands, as mentioned in jtb's answer.)

† With the exception of top, the individual commands I listed are only considered safe when run without arguments. The others each have arguments that could be destructive or surprising to users if run without user confirmation. The set of "safe" commands can be customized with defaults write com.apple.Terminal RestorableCommands -array ... by setting the preference to an array of strings. To specify that it's safe to run a command with arguments, include an asterisk where arguments would be. The default value for this preference is: "screen", "tmux", "emacs", "vi", "vim", "nano", "pico", "top *"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.