For example, to keep Stickies permanently open, remove Stickies from the login items for your account (if you've placed it there), quit Stickies, and then create the following plist file in the LaunchAgents folder of your home Library (~/Library/LaunchAgents) with the name user.launchkeep.stickies.plist:
<?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>Label</key> <string>user.launchkeep.stickies</string> <key>KeepAlive</key> <true/> <key>Program</key> <string>/Applications/Stickies.app/Contents/MacOS/Stickies</string> </dict> </plist>
launchctl load ~/Library/LaunchAgents/user.launchkeep.stickies.plist
Stickies will now effectively be un-removable -- any time it quits, crashes, or gets forced-quit it will pop right back up. If fact, in order to quit the app at any time other than logout or shutdown you'll need to disable the job; In Terminal type
launchctl remove user.launchkeep.stickies
Or you can set up a script that does that for you.
Note that you have to use the path to the inner executable, not the path to the app package - you can find this by right clicking on the app icon, choosing Show Package Contents, and navigating down to the MacOS folder where the main executable is stored. If you do something wrong, the general result will be that the app is not only kept alive, but in fact keeps launching every 10 seconds or so (launchd's throttle time-out), so that it keeps grabbing screen focus, which is very annoying. if that happens, just unload the plist, make sure it is correctly written and the app is quit, then load it again.
[crarko adds: I haven't tested this one.]