Terminal gets bash to go through and elaborate dance to keep separate histories for each tab. Normally (for me anyway) after a restart of Mac OS these separate histories are lost and you are left with just one.

At one time (years ago) the separate histories survived a reboot (much to my delight) but after yet another OS upgrade it went back to the old behavior.

Over the intervening period I have done sporadic searches trying to find out if I imagined this and what the expected behaviour is but turned up nothing useful.

So, was I imagining this and if not how do I get terminal to preserve individual histories between reboots/logouts?

There is this post which I think addresses the same issue but the answer is bit cryptic for me and it isn't clear where you should add the trap command. Although it may explain why the behaviour comes and goes if that trap is at the in /etc/bashrc_Apple_Terminal and then another OS release comes along without it!

  • It appears the answer you linked to is relevant to your issue. The only line in /etc/bashrc_Apple_Terminal that contains a trap is the very last line: trap shell_session_update EXIT. The answer implies substituting HUP for EXIT may have helped, but as you've noted, it may be version-dependent. There's also a suggestion in that Q&A that how Terminal is terminated (exit vs. Command-Q) is relevant. Changing EXIT to HUP is worth a try IMHO (easy & easily restored) - see what happens. – Seamus May 22 at 22:55
  • help history; you could try setting a different HISTFILE=/Users/mac/.bash_history; for each tab. No idea how you would coordinate these. – historystamp May 23 at 0:37

You must log in to answer this question.

Browse other questions tagged .