<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello James,</div><div class=""><br class=""></div><div class="">If I remember correctly, you need special keys in your tool and app info plist files with codesigning designated requirements. Did you verify that these designated requirements verify correctly against the actual tool and app you are using while testing?</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Thomas</div><br class=""><div><blockquote type="cite" class=""><div class="">On 27 Jan 2017, at 20:31, James Foster &lt;<a href="mailto:james.foster@gemtalksystems.com" class="">james.foster@gemtalksystems.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">According to Damien Sorresso, BSD Engineering, Apple Inc. (see <a href="https://lists.macosforge.org/pipermail/launchd-dev/2010-October/000834.html" class="">https://lists.macosforge.org/pipermail/launchd-dev/2010-October/000834.html</a>), "ServiceManagement will check the CFBundleVersion of the tool and, if it's the same ..., will not overwrite it."</div><div class=""><br class=""></div><div class="">I've updated my code to show the CFBundleVersion of the tool both before and after a "successful" invocation of SMJobBless(). Is there anything I can do to get this to work?</div><div class=""><br class=""></div><div class="">2017-01-27 09:10... existing: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;84&lt;/string&gt;</div><div class="">2017-01-27 09:10... replacement: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;E6&lt;/string&gt;</div><div class="">2017-01-27 09:10... SMJobBless(com.GemTalk.GemStone.Helper,...) returned true...</div><div class="">2017-01-27 09:10... now found: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;84&lt;/string&gt;</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Jan 25, 2017, at 4:48 PM, James Foster &lt;<a href="mailto:james.foster@gemtalksystems.com" class="">james.foster@gemtalksystems.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">I am attempting to replace a helper tool. Most of the time if I increment the version (of my application and of the helper tool) then the new tool will be installed. Sometimes it won't be installed and I have to delete the old one manually. The problem seems to occur about every dozen versions or so, and once it happens the replacement will not occur even if I change the version numbers again.
</pre><div class=""><br class=""></div><div class=""><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><a href="https://developer.apple.com/reference/servicemanagement/1431078-smjobbless?language=objc" rel="nofollow" target="_blank" style="outline: none; cursor: pointer;" class="">https://developer.apple.com/reference/servicemanagement/1431078-smjobbless?language=objc</a> states "If the job is already installed, success is returned.”&nbsp;</pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br class=""></pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">How does SMJobBless() determine that the job is already installed? What do I need to do, beyond creating an entirely new job name, to make it look different enough to replace?</pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br class=""></pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Following is my code and console output (from&nbsp;<span style="font-family: inherit;" class="">macOS 10.12.2)</span><span style="font-family: inherit;" class="">.</span></pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br class=""></pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">James Foster</pre><pre class="preContent" style="outline: none; font-family: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br class=""></pre></div><div class=""><div class=""><br class=""></div><div class="">CODE:</div><div class=""><br class=""></div><div class="">- (void)installHelperTool;</div><div class="">{</div><div class="">&nbsp; &nbsp; OSStatus status = AuthorizationCreate(...);</div><div class="">&nbsp; &nbsp; // handle errors</div><div class="">&nbsp; &nbsp;&nbsp;</div><div class="">&nbsp; &nbsp; NSLog(@"existing: %@", [self system:@"/usr/bin/otool -P "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>"/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>"grep -A 1 VersionString | tail -1"]);</div><div class="">&nbsp; &nbsp; NSLog(@"replacement: %@", [self system:@"/usr/bin/otool -P "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>"GemStone.app/Contents/Library/LaunchServices/com.GemTalk.GemStone.Helper | "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; "grep -A 1 VersionString | tail -1"]);</div><div class="">&nbsp; &nbsp; CFErrorRef cfError = nil;</div><div class="">&nbsp; &nbsp; if (SMJobBless(kSMDomainSystemLaunchd, (__bridge CFStringRef)@kHelperIdentifier, authRef, &amp;cfError)) {</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; NSLog(@"SMJobBless(%s,...) returned true; attempting (%s).", kHelperIdentifier, kShortVersionString);</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>NSLog(@"now found: %@", [self system:@"/usr/bin/otool -P "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span> "/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | "</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>"grep -A 1 VersionString | tail -1"]);</div><div class="">&nbsp; &nbsp; } else {</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; AppError(@"Helper tool installation failed: %@", [(__bridge NSError*) cfError localizedDescription]);</div><div class="">&nbsp; &nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">CONSOLE:</div><div class=""><br class=""></div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.368568 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>authd<span class="Apple-tab-span" style="white-space:pre">        </span>Succeeded authorizing right 'com.apple.ServiceManagement.blesshelper' by client '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] for authorization created by '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] (13,0)</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.889238 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>kernel<span class="Apple-tab-span" style="white-space:pre">        </span>AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.385444 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>GemStone<span class="Apple-tab-span" style="white-space:pre">        </span>existing: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;1.3.3.9&lt;/string&gt;</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.900905 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>kernel<span class="Apple-tab-span" style="white-space:pre">        </span>AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.397113 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>GemStone<span class="Apple-tab-span" style="white-space:pre">        </span>replacement: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;1.4.0&lt;/string&gt;</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.398426 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>authd<span class="Apple-tab-span" style="white-space:pre">        </span>Succeeded authorizing right 'com.apple.ServiceManagement.blesshelper' by client '/usr/libexec/smd' [251] for authorization created by '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] (3,0)</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.408694 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>GemStone<span class="Apple-tab-span" style="white-space:pre">        </span>SMJobBless(com.GemTalk.GemStone.Helper,...) returned true; attempting (1.4.0).</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.923798 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>kernel<span class="Apple-tab-span" style="white-space:pre">        </span>AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.</div><div class="">default<span class="Apple-tab-span" style="white-space:pre">        </span>14:25:04.419988 -0800<span class="Apple-tab-span" style="white-space:pre">        </span>GemStone<span class="Apple-tab-span" style="white-space:pre">        </span>now found: <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;string&gt;1.3.3.9&lt;/string&gt;</div></div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">launchd-dev mailing list<br class=""><a href="mailto:launchd-dev@lists.macosforge.org" class="">launchd-dev@lists.macosforge.org</a><br class="">https://lists.macosforge.org/mailman/listinfo/launchd-dev<br class=""></div></blockquote></div><br class=""></body></html>