How to automatically restore window arrangement from last time in iTerm?

13

6

I have two old Macs, both have iTerm2 installed and could automatically restore window arrangement (tabs with different directories and colors) from last time after launch. I forget what configuration I've made for both.

Now I'm setting up a new Mac with iTerm2, but could never get "automatically restore window arrangement from last time" working there.

What I've tried:

  1. Compared with the working ones, check and set the preferences one by one;
  2. Cloned the working "~/Library/Preferences/com.googlecode.iterm2.plist";
  3. Preferences -> Profiles -> General -> Working Directory -> Reuse previous session's directory (but I think this impacts when you open a new tab, not for launch);
  4. Menu -> Window -> Save Window Arrangement -> and save it as default. But in this case, every time if I launch from start, iTerm always restore fixed window arrangement from the save. I don't want to save any pattern, I just want restore whatever I have from last time.

All the things I've tried could not make it work. Could anyone tell me what should I do please? Thanks a lot.

iTerm version: iTerm2-1_0_0_20140112

Jing Li

Posted 2014-03-08T14:10:55.733

Reputation: 233

One more hint: both of the working Macs, I haven't used any AppleScript, just checked some options in the preferences. – Jing Li – 2014-03-08T14:12:55.867

Answers

28

In iTerm2's preferences (Cmd + ,), change General > Startup from Open Default Window Arrangement to Use System Window Restoration Setting.

In System Preferences, turn off General > Close windows when quitting an app.

George

Posted 2014-03-08T14:10:55.733

Reputation: 1 496

In 2019, iTerm v3+ I had to just go to Preferences -> Arrangements and click "Set Default" on your created arrangement (save it first by clicking cmd+shift+S) – trainoasis – 2019-06-27T07:42:42.990

1Thanks @George, that solves the problem! So the trick is to turn off one option in System Preferences which is outside app config. – Jing Li – 2014-05-19T05:49:14.913

12

I wrote a program designed to solve this pain point for myself, which allows you to create pre-defined layouts of panes and commands (for different projects/setups etc.) and then load them in iTerm whenever you want.

It is called iTermocil, and you can download it (and the source code) via Github: https://github.com/TomAnthony/itermocil.

enter image description here

Tom Anthony

Posted 2014-03-08T14:10:55.733

Reputation: 231

2

In 2019 (iTerm v3.2.9), what works for me is:

  1. Save your current arrangement by clicking CMD + shift + S (or go Window -> Save Window Arrangement.

  2. Now go to iTerm2 -> Preferences -> Arrangements -> select your arrangement in the list of arrangements -> Click "Set Default" at the bottom.

Now when you reopen iTerm at any point it will open your new arrangement.

trainoasis

Posted 2014-03-08T14:10:55.733

Reputation: 121