How can I cause Terminal to open a new window with a specific “Settings”, without having to mouse into the File menu, but rather by opening a file or running a command or AppleScript (i.e. something I can launch)?

In versions before Leopard, I did this by opening the .term files in ~/Library/Application Support/Terminal. However, this is now considered an “import” and results in duplicate entries cluttering up the list of Settings-es, and changes to the settings aren't written back to that file.

I care about using Settings for two reasons:

  • I like to have color schemes for my terminals specific to their job, so I can find them easily in the Dock.
  • The startup command for a Settings appears to be the only way to cause a command to be rerun upon restore-after-quit. (File → New Command… does not.)

Other solutions that would be satisfactory:

  • A terminal application which supports this and otherwise has a similar UI and feature set to Terminal.app, e.g. editable window titles and rewrapping on resized windows, just to name a couple of unusual and especially “Mac” features.
  • A way to automatically clean up those duplicate Settings and write changes back to files.

Use AppleScript. I use this one:

tell application "System Events" to click menu item "<<saved settings set>>" of menu "New Window" of menu item "New Window" of menu "Shell" of menu bar item "Shell" of menu bar 1 of application process "Terminal" of application "System Events"

If you've found a way to do this from the command line (e.g. by calling Terminal.app with parameters) or with saved files, I'm also interested to know. I've also tried using Keyboard Shortcuts but couldn't get that to work because I couldn't assign a shortcut to a configuration by name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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