ZSH iterm2 increase number of lines history


Terminal Problem Overview

Not sure if this is zsh, iterm2 or the interaction between them. Trying to change the number of recallable lines in the terminal - not the command history, the output history.

In .zshrc I have :


This seems to be ignored =(

Not sure of the correct term to google, "Terminal output history?"

Terminal Solutions

Solution 1 - Terminal

It's not immediately obvious in the iTerm2 documentation on how to change it.

  • open the iTerm2 preferences + ,
  • select the Profiles tab
  • then select the Terminal subtab
  • Beware, changes to the Scrollback lines value take effect immediately so check Unlimited scrollback now if you don't want to delete your current buffer(s)
  • change the value of the Scrollback Lines to whatever you'd like
  • Uncheck the Unlimited scrollback option if you'd like to use your Scrollback lines value

enter image description here

Solution 2 - Terminal

It's not a shell problem, it's about your terminal emulator.
You have to find the option in the configuration / options / tools / whatever, for the number of lines to remember.

Apparently you know your terminal emulator is iterm2.

Looking for iterm2 on the google will lead you to the official website, then go to 'Documentation', Ctrl+F 'number' and find

Scrollback lines
The number of lines of scrollback buffer to keep above the visible part of the screen.

Solution 3 - Terminal

With zsh and iTerm2 Build 3.2.5, an additional step is required: Preferences->Profiles->terminal->check UnlimitedScrollback->Check save lines to scrollback when an app status bar is present

Scrolling was breaking for me without the last one.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionxxjjnnView Question on Stackoverflow
Solution 1 - TerminalTravisView Answer on Stackoverflow
Solution 2 - TerminallolesqueView Answer on Stackoverflow
Solution 3 - TerminaljokView Answer on Stackoverflow