Disable Resume on a per-application basis
Terminalを使い各AppのSessionを動かさなくする方法
まずここのAppをチェックします。com.apple.Safariなど...
$HOME/Library/Saved\ Application\ State/com.apple.Safari.savedState
$HOME/Library/Saved\ Application\ State/com.apple.Terminal.savedState
$HOME/Library/Saved\ Application\ State/com.apple.TextEdit.savedState
例 SafariのSessionを記憶させない...
defaults write com.apple.Safari ApplePersistenceIgnoreState YES
元に戻す時は...
defaults write com.apple.Safari ApplePersistenceIgnoreState NO
defaults delete com.apple.Safari ApplePersistenceIgnoreState
# deleteはPLISTからKEY: ApplePersistenceIgnoreStateを消去する
TextEditだと...
defaults write com.apple.TextEdit ApplePersistenceIgnoreState YES
defaults write com.apple.TextEdit ApplePersistenceIgnoreState NO
Shell Scriptを作りました。# toggle
Safari_Saved_State
#! /bin/bash
AAA="$(defaults read com.apple.Safari ApplePersistenceIgnoreState)"
if [ "$AAA" = "NO" ]; then defaults write com.apple.Safari ApplePersistenceIgnoreState YES; say "disable"
else defaults write com.apple.Safari ApplePersistenceIgnoreState NO; say "enable"
fi
TextEdit_Saved_State
#! /bin/bash
AAA="$(defaults read com.apple.TextEdit ApplePersistenceIgnoreState)"
if [ "$AAA" = "NO" ]; then defaults write com.apple.TextEdit ApplePersistenceIgnoreState YES; say "disable"
else defaults write com.apple.TextEdit ApplePersistenceIgnoreState NO; say "enable"
fi
# 3つのApp名の変更で他のAppのも作れます。Shell Scriptの作り方は省きます。