At some point, Terminal started saving sessions. It's controlled with /etc/bashrc_Apple_Terminal. For some reason, my subshells are also using this feature:

echo $(cd && pwd)
/Users/ehrmann Saving session... ...saving history...truncating history files... ...completed.

As a workaround, I can do

echo $(SHELL_SESSION_FILE= && cd && pwd)

Luckily, it works across platforms, but it's kinda silly.

Did I accidentally do something that turned this on? This can't be the intended default behavior—it breaks all sorts of things.


I’m not certain when this became the default, but I agree, it’s an annoying default; it was added in one of the last few major releases. I came across this question because I was searching for how to best disable this, and I think you may have provided the solution yourself:

In /etc/bashrc_Apple_Terminal, there is great amount of documentation about how the functionality in the file is implemented.

The final comment is the kicker:

# The save/restore mechanism is disabled if the following file exists:
#   ~/.bash_sessions_disable

I tested this on my machine and it works, no more session saving.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .