Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mac Pro 2009

macrumors member
Original poster
Jan 3, 2014
88
0
Hey everyone!
Noticed some strange behaviour in terminal recently, after a clean install of Mavericks, terminal suddenly remembers everything I ever typed in... How do I make this stop? Should I be worried by this? Never had this happen before...
Thanks!
 
Last edited:

Phil A.

Moderator emeritus
Apr 2, 2006
5,800
3,100
Shropshire, UK
That's the intended behaviour so if it wasn't working before there was something wrong (probably ownership of the .bash_history file)
 

Mac Pro 2009

macrumors member
Original poster
Jan 3, 2014
88
0
What I mean is that whenever I open terminal it lists all my previous commands (like from two days ago) above "[Restored]". I find this to be an annoyance...
 

Phil A.

Moderator emeritus
Apr 2, 2006
5,800
3,100
Shropshire, UK
What I mean is that whenever I open terminal it lists all my previous commands (like from two days ago) above "[Restored]". I find this to be an annoyance...

Sorry, I misunderstood what you meant before.

To stop this you have to do the following (which will affect all applications):

In system preferences, general, set the check box next to "Close windows when quitting an app"

You can also do it with the following command which then applies to Terminal only

Code:
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false


To return to the default behaviour of following the settings in system prefs use this command

Code:
defaults delete com.apple.Terminal NSQuitAlwaysKeepsWindows



Close and re-open Terminal for it to take effect


The third option is simply to make sure you close all terminal windows before quitting :)
 
Last edited:

Mac Pro 2009

macrumors member
Original poster
Jan 3, 2014
88
0
Sorry, I misunderstood what you meant before.

To stop this you have to do the following (which will affect all applications):

In system preferences, general, set the check box next to "Close windows when quitting an app"

You can also do it with the following command which then applies to Terminal only

Code:
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false


To return to the default behaviour of following the settings in system prefs use this command

Code:
defaults delete com.apple.Terminal NSQuitAlwaysKeepsWindows



Close and re-open Terminal for it to take effect


The third option is simply to make sure you close all terminal windows before quitting :)

That worked, you are a genius! Thanks man!
 

sharon22

macrumors regular
Oct 19, 2014
194
0
Hello OP, you got some good answers. But before you go and "turn off" the "remember history" setting, I want to submit that my FAVORITE feature of Terminal (or any Command-Line application) is having it remember history! OMG I cannot COUNT how many times I am thankful that it remembers history.

Obviously, it may be of a privacy concern if you are on a shared computer... but if you are NOT on a shared computer, please consider leaving the History "on" for a few months. If it turns out you *never* use this default feature, then turn it off.

Case in point: On occasion, I do that "sudo remove force Trash **" thingy, to "force empty trash." Well, see, Terminal only keeps the past 500 commands, and my Force Empty trash was lost, so I figured I had used it enough that I should have it memorized. Well, I had an extra space in the command, and ended up DELETING NEARLY ALL of my entire home directory! Permanently! Now, if the "sudo force delete trash" command was in my Terminal, I could have just hit the "up arrow" 'till I found it, then it would have worked properly instead of deleting my whole computer.

Just a thought.

Do as thout wishest :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.