{"id":3697,"date":"2014-03-29T08:04:51","date_gmt":"2014-03-29T08:04:51","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/using-a-launchagent-inside-the-mac-app-sandbox-collection-of-common-programming-errors\/"},"modified":"2014-03-29T08:04:51","modified_gmt":"2014-03-29T08:04:51","slug":"using-a-launchagent-inside-the-mac-app-sandbox-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/using-a-launchagent-inside-the-mac-app-sandbox-collection-of-common-programming-errors\/","title":{"rendered":"Using a LaunchAgent inside the Mac app sandbox-Collection of common programming errors"},"content":{"rendered":"<p>How would you use a LaunchAgent inside the sandbox? I want to distribute a UI-less LaunchAgent app bundle inside my main application that I can launch on demand. The reason I want this instead of an XPC service is for the <code>KeepAlive<\/code> option, which will prevent <code>launchd<\/code> from automatically killing my process when its idle. This option doesn&#8217;t exist on XPC services.<\/p>\n<p>The documentation says that there&#8217;s a plist that needs to be copied into <code>~\/Library\/LaunchAgents<\/code>, and this is obviously not possible inside the sandbox. Is there some sort of system API that would handle copy the plist for me? I&#8217;ve seen Apple&#8217;s SMJobBless sample code, but it seems like that&#8217;s for registering a privileged LaunchDaemon rather than an unprivileged LaunchAgent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How would you use a LaunchAgent inside the sandbox? I want to distribute a UI-less LaunchAgent app bundle inside my main application that I can launch on demand. The reason I want this instead of an XPC service is for the KeepAlive option, which will prevent launchd from automatically killing my process when its idle. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3697","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3697"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3697\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}