How can I disable Bash sessions in OS X El Capitan
This behavior is defined in /etc/bashrc_Apple_Terminal
. It contains documentation comments describing what it does and how to customize it.
You can disable the per-terminal-session command history feature by setting SHELL_SESSION_HISTORY=0
in your ~/.bashrc
script, as described here:
You may disable this behavior and share a single history by setting SHELL_SESSION_HISTORY to 0. There are some common user customizations that arrange to share new commands among running shells by manipulating the history at each prompt, and they typically include 'shopt -s histappend'; therefore, if the histappend shell option is enabled, per-session history is disabled by default. You may explicitly enable it by setting SHELL_SESSION_HISTORY to 1.
Note that, although you can disable the entire session-state restoration mechanism by creating ~/.bash_sessions_disable
, this is unnecessary just to disable the per-session command history feature, and is not recommended.
If you startup a new Bash session manually (i.e. bash -xl
), you can see what is run on login.
You'll see the following line in the output:
....
+++ '[' '!' -e /Users/username/.bash_sessions_disable ']'
You can create a .bash_sessions_disable
file in your home directory to disable this functionality.