I do this is in this order:
Remove property list.
Remove helper tool.
Remove the job.
Hi @quinn, are you sure we need to 'Remove the job' here. I followed the steps you captured here to remove my 'helper tool' using 'sudo launchctl remove /Library/LaunchDaemons/com.my***.Installutil.plist' and I had to and running SMJobBless() didnt work again. I even rebooted my macbook which didnt help. SMJobBless was not giving any error and no errors were captured in console logs. Console log was showing 'backgroundtaskmanagementd' did the job normally:
2024-01-18 21:51:33.286201+0530 0x607f8 Default 0xa7a28 474 0 backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=(null), type=legacy daemon, url=file:///Library/LaunchDaemons/com.my***.Installutil.plist, config={
BTMConfigArguments = (
"/Library/PrivilegedHelperTools/com.my***.Installutil"
);
BTMConfigBundleIdentifiers = (
);
BTMConfigExecutablePath = "/Library/PrivilegedHelperTools/com.my***.Installutil";
BTMConfigLabel = "com.my***.Installutil";
}
After spending 2 days I thought to doubt the step captured here. To recover the setup I had to call SMJobBless() API which didnt start the helper tool, but copied the plist and helper too, to its location, then I had to run 'sudo launchctl load -w -F /Library/LaunchDaemons/com.my***.Installutil.plist' separately and then it started to work.
I am capturing the steps below for others so that they dont run into same problem:
How to uninstall a helper tool:
Remove property list.
Remove helper tool.
Note dont run 'launchctl remove' if you wise to reinstall the helpertool again. I still have to try 'SMJobRemove' API and check if that removes the job from the launchctl list. else @quinn can guide how to remove the job from launch list, otherwise as pointed by quinn earlier the next reboot will remove the entery from the list.