MacOS - turning off the bash session restore

I’ve tried editing /etc/bashrc_Apple_Terminal as well as adding files such as .bash_profiles, etc to my home folder but my session history keeps showing - when I open terminal, it will open 3 windows with its history. What to do? Thanks!

Edit: SHELL_SESSION_HISTORY=0 does not work as well


If you want to discard your Terminal state, you have to quit with holding the Alt key. The menu will change from "Quit Terminal" to "Quit and close all windows".

enter image description here

You can also make it effective with the "normal" quit Cmd + Q, this way:

  1. Open your terminal
  2. Delete the content of the saved state folder: rm -rf ~/Library/Saved\ Application\ State/com.apple.Terminal.savedState/*
  3. Lock the folder: chflags uchg ~/Library/Saved\ Application\ State/com.apple.Terminal.savedState/
  4. Now, every time you quit your terminal, it won't be saved