Skip to main content

How to disable "Reopen windows when logging back in" in Mac OS X Lion

We might have seen when we log out, restart or shutdown Mac OS X Lion, we get a dialog window with a check box next to “Reopen windows when logging back in” that restores all of your currently open applications and windows. To disable this feature there is no visible preference/configuration item to do this. The mac os x stores all the window related information under under each users preferences directory. Upon next login it loads all the windows based on the saved data under preferences. The following section helps you in how to disable this.

1. Write a shell Script as below and and save as :
   echo "#!/bin/bash" > /tmp/
 echo "rm/Users/*/Library/Preferences/ByHost/*" >>/tmp/
   mv /tmp/ /usr/bin/
   chmod +x /usr/bin/
   defaults write LoginHook /usr/bin/

2. Run the with sudo privileges. and you are Done .

 Upon next reboot, start, login you will not windows launching again 

Note : 

1. The above shell script disables “Reopen windows when logging back in” , but you will still the check box enabled on “Reopen windows when logging back in” in dialog box but it will not have any effect as we have disabled the feature completly.

2. The above fix is different from Mac OS X Lion restore and Application window restore. To disable the Mac OS X Lion resume and Application window restore please follow below steps :
       1. Launch System Preferences.
       2. Goto General,
       3. Disable "Restore windows when quitting and re-opening apps"


Popular posts from this blog

How to find firmware or boot ROM version in Mac OS X

Firmware and boot ROM version of your mac can be found in two ways.
Way 1 :
1. From "Apple" menu , choose "About This Mac" menu item. 2. Click " More Info " to open "System Profiler" application. 3. Under Contents -> Select Hardware Tree item.
On the right side panel Under hardware overview section, we can see Boot ROM Version and SMC (Firmware) Version.

Way 2 :
Run the below command in terminal to get boot ROM version and SMC(firmware) version :
$ system_profiler SPHardwareDataType | grep -i "Version" | awk -F ':' '{print $1 $2}'

How to disable USB ports on Mac OS X Mavericks, Yosemite or El Capitan ?

We might wonder how to disable the USB ports on Mac to prevent data copy to external USB mass storage devices. The USB kext on os x is loaded at the time of start of the system, this can be loaded / unloaded using kextload or kextunload command. To disable USB port on Mac , follow below steps:
On Macs running Mountain Lion, Mavericks  and Yosemite:
Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDISK.Now unload the USB related kernel extensions in the following order using kextunload command.sudo kextunload -b
sudo kextunload -b
sudo kextunload -b

       This will unload the USB kext and disable the USB ports for storage devices on Mountain Lion, Mavericks  and Yosemite.
On Mac running El Capitan:
Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDI…