Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Problems with history



I’ve battled this problem before and I thought I had a fix but I guess not.  I’m asking for help on how to debug this.

I want my history to be very large.

I’m on macOS 26
/bin/zsh —version reports zsh 5.9 (arm64-apple-darwin25.0)
/opt/homebrew/bin/zsh —version reports zsh 5.9 (arm-apple-darwin22.1.0)
I’m assuming Terminal uses /bin/zsh

In my login file I have:

: ${HISTFILE:=${ZDOTDIR:-$HOME}/.zsh_history}
SAVEHIST=1048576
(( HISTSIZE = SAVEHIST * 2 ))

For those familiar with macOS’s zsh per session history I have this in my .zshenv:

# Stop the Apple Terminal session history
export SHELL_SESSIONS_DISABLE=1
export SHELL_SESSION_HISTORY=0

The system’s /etc/zshrc has these lines:

# Save command history
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
HISTSIZE=2000
SAVEHIST=1000

Yet my history when I first open a Terminal stays at around 1000 lines.  I have EXTENDED_HISTORY set yet my history file (1000 lines) only goes back to 12/15/2025 (today)… Oh… Hmmm… I guess when the history is read in, the time and date is not saved?

Some questions that would help me:

When is the history file read in?  
Does setting HISTSIZE or SAVEHIST cause the current history list to get truncated?
Is there any other things I should check?

Thank you for your help,
pedz





Messages sorted by: Reverse Date, Date, Thread, Author