#### Using The Terminal in macOS

##### May 28, 2017
Software

I’m not one for heavy modifications, but there are certain behaviours that I expect and if they don’t happen I’ll get frustrated. One of those behaviours is the .bash_history on the command line. I’m not sure when it happened, but the default behaviour currently in macOS 10.12.5 is to not use this file, and instead make use of sessions, and a per-session command history. Fortunately, there is built in a way to get the old behaviour back. Looking at /etc/bashrc_Apple_Terminal there is a rather long comment describing the current behaviour:

# Resume Support: Save/Restore Shell State
#
# Terminal assigns each terminal session a unique identifier and
# communicates it via the TERM_SESSION_ID environment variable so that
# programs running in a terminal can save/restore application-specific
# state when quitting and restarting Terminal with Resume enabled.

In that comment block it describes how to disable this mechanism, and handily this also brings back the classic functionality that I desire!

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

So it’s simply a matter of:

\$ touch ~/.bash_sessions_disable


I don’t really make any other functional changes to the system, maybe an alias or two in ~/bash_profile for convenience, but that’s it. Some people will install all sorts of things like MacPorts, HomeBrew, Fink, et cetera, but I really haven’t had a need. MacOS ships a functioning git, python, ruby and all the other stuff I need day to day and I’m not missing any of the newer features provided by updating stuff, so unless there’s a pressing need…