Disabling application save state in macOS

Solved

I'm attempting to get CI working on some Mac machines and have been hitting stalls with macOS asking if I'd like to restore the application if it crashes. I'd really like to disable this behavior (it's fine if it is system-wide too; the machine is ~never going to have a human in front of it to answer any of these questions anyways). I've tried making the relevant .savedState directories under ~/Library/Saved Application State and making the unwriteable (either via sudo chown root or locking via the Finder panel thing), but then I get errors during testing about not being able to open a saved state file which then gets detected as a failure and fails the test. Can I just disable this behavior? It seems that 10.15 no longer has the "Restore windows when quitting and re-opening apps" under General (apparently introduced in 10.7), but I suppose maybe defaults can access it behind the scenes?

Thanks.

Posted Sep 3, 2020, 9:48 PM UTC

11
mathstufOP•

Found the answer: defaults write -g ApplePersistence -bool no

1