Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I prevent Terminal from showing me my old output when it starts?

I would like it to always start with a clean window.

share|improve this question

4 Answers 4

up vote 13 down vote accepted

You can change terminal only with this one command to write a new preference for that specific app.

defaults write com.apple.terminal NSQuitAlwaysKeepsWindows -bool false

This is general, so of course, substitute safari or quicktimeplayerX or whatever in the com.apple.terminal portion of the command as needed. This setting switches the default save behavior upon quitting that one app. You'll find many of the other apps that work well with this setting by searching on NSQuitAlwaysKeepsWindows.

Of course, you should issue this defaults command after closing all windows and then quitting the application to ensure the settings are read the next time Terminal starts.

share|improve this answer
    
You can also close all the windows when quitting. Sometimes I like it to be clean. Sometimes I like retaining the old output. –  bahamat Sep 14 '11 at 2:26

The only way to do this is to completely disable the resume feature in Lion

http://www.macrumors.com/2011/07/20/how-to-disable-lions-resume-feature/

share|improve this answer
6  
This does work, but it's overkill since defaults write com.apple.terminal NSQuitAlwaysKeepsWindows -bool false will quash this behavior on terminal only. –  bmike Sep 13 '11 at 22:01

Besides setting the preference to always suppress Resume, you can also control this when quitting by pressing the Option modifier key, so that "Quit …" becomes "Quit and Discard Windows". e.g., you can type Option-Command-Q to quit without saving state. You can also press the Shift modifier when an application is opening to prevent it from restoring state for Resume.

There is also a Terminal preference (without UI) for controlling how many lines of the scroll-back to restore, which you can set to zero, although it still restores the display contents:

defaults write com.apple.Terminal RestoreScrollbackLines 0
share|improve this answer

You can actually deactivate "save state" on per-app basis, have a look at https://faqintosh.com/risorse/en/sys/swapsaveability/

HTH

share|improve this answer
    
Welcome to Apple! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  daviesgeek Mar 17 '12 at 16:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.