Screen Shot 2012-02-21 at 4.29.56 PM

Fixing Lion Annoying Resume

MacOS X Lion has lots of great features and it somewhat makes MacOS X as close as iOS (this is what Apple is trying to do) . One thing which I hated in OSX was its resume functionality , like how application and system resumes when you shut it off or restart it. Of course you have the option of turning it off every time you reboot/restart , but you’ll have to untick it and reboot for a clean reboot , else it would load up all the applications that you had previously and this would have an impact on boot time (unless of course you are using SSD).

I’ve found this great guide in MacOS X hints which describes how to do it , but unfortunately , it was not clearly explained as I would prefer to explain on what these commands do as you could understand them and improve your UNIX skills.

I’ve divided into two parts , one is to disable application resume and the other one is to disable system wide resume (aka resume-on-reboot)

Disabling Saved Application States 
We’ll be disabling application save states , which means when you relaunch Safari for instance , your online banking stuff does not show up  nor all your previously opened tab. Some may argue its useful but however others may do this for performance and security reasons

1. Fire up Terminal

2. Type this command

sudo rm -r ~/Library/Saved\ Application\ State/*

What this command does is basically to remove application states which are stored in the directory , to delete old states

3.  sudo chmod -R a-w  ~/Library/Saved\ Application\ State/*

This command makes the folder Read-Only , so that it can’be written by the system nor you. So applications can’t store its saved state.

If you would like to undo it , simply change it to a+w. Now if you are looking for a simpler solution with Graphical User interface without getting your hands dirty , RestoreMeNot is a great application that does exactly this but with a graphical user interface. Now you know the science behind this !

 

Disabling Reopen Windows when I log back in

This is another annoying thing that I find with lion. Its nice to have everything that you left reopened them back for you when you login back , but some of us would prefer a clean reboot. The reason why we may reboot is because we just want to reclaim our memory or we can’t force quit the program  thus forcing us to do a reboot and now imagine if the application gets loaded back again.  The folks over at OSXDaily , did make a script which does it for you. So head over there and grab the script , its a simple command , just copy and paste it and basically the script would set the permissions and everything up for you. Now if you prefer to do it by hand you may do so with the following commands and their explanation as well

1. Type this out in Terminal

defaults write com.apple.loginwindow TALLogoutSavesState -bool false

 

Defaults command is used to save states , its commonly used to mess with OSX Internals. In this case it writes to LoginWindow (the application that is in charge of GUI and Finder) to disable save states.

 

2.  Next type this out

     sudo chmod a-w ~/Library/Preferences/com.apple.loginwindow.plist

 

Much like the previous command it simply means that as read-only so that the settings does not get overwritten , by default OSX turns them out. This should turn them off

 

3. However OSX is pretty smart , it will automagically reclaim ownership and you’ll have to stop it

sudo chown root ~/Library/Preferences/com.apple.loginwindow.plist

It simply means ownership is held by root instead of you , which means OSX can’t change its settings , thus making it as read-only.

 

Of course if you would like to undo the settings , simply work backwards. Change ownership back to your name , change chmod a+w and set the defaults back to true. Isn’t that simple ?

If you have a software or any other ways of doing it , feel free to share and drop a comment

One thought on “Fixing Lion Annoying Resume”

  1. Do these commands also uncheck visually the “Reopen Windows when I log back in” on the shutdown window?

    thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge