Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMJobRemove succeeds, but plist and helper tool not deleted

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);

like image 669
redshift5 Avatar asked Nov 03 '22 19:11

redshift5


1 Answers

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".

like image 106
redshift5 Avatar answered Nov 15 '22 05:11

redshift5