I've got an annoying problem with iterm2 not remembering my history when I close out a terminal window. I'm not sure if it might be my .bash_profile config or what.
Here is what is happening:
1) type in some commands 2) issue `history` command 3) commands are listed 4) close terminal window and open brand new terminal window 5) issue `history` command 6) commands from previous sessions are NOT listed 7) close terminal window and open brand new terminal window 6) issue `history` command 7) commands from very first session now appearing
Anyone know why the previous commands aren't showing up right away when a new window is opened and only after a second terminal window is opened?
UPDATE: Everything works as expected with the plain old terminal app.
Update 2: I have the shell integration feature installed
Update 3: It turns out the first update was incorrect. It is also flaky on Terminal. Sometimes it will work and other times it doesn't.
SHELL_SESSION_HISTORY=0to your~/.bash_profilefile, quite the Terminal/iTerm2 App and reopen, test again. – user3439894 Aug 18 '18 at 20:11~/.bash_profilewithSHELL_SESSION_HISTORYdidn't do anything. The problem was.bash_historyhaving permissions-rw------- root staffas set by/etc/bashrc_Apple_Terminal. Little bit ofchowning solved it. Now history works with iTerm2. – Jari Turkia Jun 02 '20 at 10:52