Automatic Application Termination & Servers

One of the new features that was introduced in OS X Lion is automatic application termination. This feature stops any applications that haven’t been used for awhile and then when you start the app back up, it fires up using the saved application state. But some processes shouldn’t be stopped. I’ve recently run into 2 cases where I needed to disable automatic termination. To do so is pretty straight forward: defaults write -g NSDisableAutomaticTermination -bool TRUE Once run, read the key back from the global defaults domain to verify it was run correctly: defaults read -g NSDisableAutomaticTermination The output should just be a 1. Provided it’s correct, now test that applications no longer automatically terminate. Provided they don’t then the setting can be left, or if your issue persists then you can just delete the key: defaults delete NSDisableAutomaticTermination While you shouldn’t have to restart for changes to activate, I do. Basically, at the relaunch of the app the changes should be active. Applications with network sockets should never stop taking resources; however, applications without network sockets that might call on them from time to time could be impacted. You can also look at doing per-application, as an example with Terminal: defaults write com.apple.terminal NSDisableAutomaticTermination -bool true Or Apple Configurator: defaults write com.apple.terminal NSDisableAutomaticTermination -bool true
  • What were the two cases, and how can you tell when a process was automatically terminated?

    • For me the two cases were the ones I used in the article. I was running some commands in terminal in a loop and it just stopped. In both scenarios it was just like a 3-5 second delay to open, but enough time to cause problems with the task I’d left idle.