Why bash history on the mac won’t save

bashterminal

I have always used bash for work, and never had problems with it. Now, it does not save any command in history again.
If I open a window terminal, try some commands, it acts like everything has worked fine and show me history using the arrow keys. But If I close the window (and that it is the time that it supposed to be save on the .bash_history file) and open another one, there are no signs of the last commands.

How can I find out what is going wrong? Or re-set everything from blank.

Best Answer

I did this:

Add a variable to .bash_profile file

SHELL_SESSION_HISTORY=0

restart the terminal and after that it is working as I'd like. (It saved the commands after I closed the terminal)

P.S. I also use the HISTFILESIZE and HISTSIZE variables

HISTSIZE is the number of lines or commands that are stored in memory in a history list while your bash session is ongoing.

HISTFILESIZE is the number of lines or commands that (a) are allowed in the history file at startup time of a session, and (b) are stored in the history file at the end of your bash session for use in future sessions.