Skip to content

Instantly share code, notes, and snippets.

@mantissa
Last active February 3, 2018 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mantissa/8231745 to your computer and use it in GitHub Desktop.
Save mantissa/8231745 to your computer and use it in GitHub Desktop.
Automatically launch OF apps upon system startup ... and restart them on crash (using OSX)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>AllOver.restart</string>
<key>ProgramArguments</key>
<array>
<string>/Users/user/pathToApp/bin/AppName.app/Contents/MacOS/AppName</string>
</array>
</dict>
</plist>
// enable the script to launch the app on startup and automatically relaunch after crashing
launchctl load /Library/LaunchAgents/KeepAppAlive.plist
// disable os crash notification messages
defaults write com.apple.CrashReporter DialogType server
// suppress os messages to relaunch after crash
defaults write -app /Users/user/pathToApp/bin/AppName.app NSQuitAlwaysKeepsWindows -bool false
// remove saved state files
rm -r /Users/user/Library/Saved\ Application\ State/com.yourcompany.openFrameworks.savedState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment