SMJobRemove succeeds, but plist and helper tool not deleted

荒凉一梦 提交于 2019-11-27 07:09:30

问题


I'm trying to remove a privileged helper tool installed via SMJobBless, I'm getting a positive return value and no errors, yet the files at /Library/PrivilegedTools and /Library/LaunchDaemons are not deleted. Do I have to delete these files myself?

From the documentation I read:

Return Value true if the job was removed successfully, otherwise false.

I'm calling the following to remove the job: result = SMJobRemove(kSMDomainSystemLaunchd, (__bridge CFStringRef)label, _authRef, YES, &errorCF);


回答1:


Thanks jatoben, that thread had the answer I was looking for.

As suspected you do have to remove the files yourself or use the following: (Taken from Apple dev forums:)

SMJobRemove is the equivalent of "launchctl remove". That is, it removes the job from launchd but has no effect on the disk at all. Thus the job will get reloaded the next time you start up. To get around that you have to either remove the plist yourself or by fork/exec'ing "launchctl unload -w".




回答2:


Have you seen https://github.com/brenwell/SMJobBless-Demo/blob/master/Uninstall.sh? It was very helpful for me.



来源:https://stackoverflow.com/questions/11557026/smjobremove-succeeds-but-plist-and-helper-tool-not-deleted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!