OSX: run an application and prevent users to close
Could you just relaunch the program immediately if a user quits it? To for example relaunch TextEdit if it is quit, you can save this plist as /Library/LaunchAgents/relaunchtextedit.plist:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;relaunchtextedit&lt;/string&gt;
  &lt;key&gt;Program&lt;/key&gt;
  &lt;string&gt;/Applications/TextEdit.app/Contents/MacOS/TextEdit&lt;/string&gt;
  &lt;key&gt;KeepAlive&lt;/key&gt;
  &lt;true/&gt; &lt;!-- run the program again if it is terminated --&gt;
  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;true/&gt; &lt;!-- run the program at login --&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Make sure the file is owned by root. Then run sudo launchctl load /Library/LaunchAgents/relaunchtextedit.plist or log out and back in to load the plist. (You could also save the plist in the user library, but then the user can unload it without having to enter a password.)