I don't think that I have seen this before, but whenever I run exit in terminal I get a very strange output.

This is what it looks like:

Saving session...
...copying shared history...
...saving history...truncating history files...

[Process completed]

And when I remove ~/.bash_sessions I get this output.

Saving session...-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.session: No such file or directory
touch: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
-bash: history: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: cannot create: No such file or directory

...copying shared history...cp: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.history: No such file or directory

...saving history...cat: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.history: No such file or directory
-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
truncating history files...
shlock: open(~/.bash_sessions/shlock6026): No such file or directory

[Process completed]

The other thing is it recreates the .bash_sessions folder if it got removed.

Is this some kind of virus or just that I haven't paid that much attention to it, or is this something that Apple added in El Capitan (I'm running OS X 10.11 Build 15A262E) or what else could it be?

Also when I run login <myusername> then I run exit I do not get this odd output. It only seems to be when closing out of terminal.

Note: I have replaced /Users/myusername with ~/ instead. I have also removed my .bash_profile to make sure it wasn't that.


This seems to be a change to Bash Session in OS X El Capitan. See Bash sessions

Also see this question in SE.

  • 1
    Ah, Thanks for that! Glad to know it is an OS based thing!
    – iProgram
    Sep 20 '15 at 20:26
  • 13
    Please include all relevant details from pages you’re referring to. They might go away, making your answer incomplete.
    – Daniel B
    Sep 20 '15 at 20:36

had the same problem. Under terminal preferences->profiles -> shell. Select appropriate action to perform under "when the shell exits" menu. Fixed my issue.

  • 1
    To just ignore the message and just exit the Terminal, under "When the steel exits:" select "Close if the shell exited cleanly".
    – sharshi
    Feb 23 '18 at 18:27

The last line of /etc/bashrc on the mac reads:

[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"

So to disable all the craziness in the Apple Terminal on exit:

sudo mv /etc/bashrc_Apple_Terminal /etc/bashrc_Apple_Terminal-disabled


You can add an alias to your shell-profile (like .bashrc) such as:

alias off='exit 0 >/dev/null'

When you use 'off', it exits with those extra messages discarded.

All you get is the 'logout' line, sent to 2>/dev.tty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.