You are right that there is no documentation for this. Basically you will write another application, an auxiliary application, that will be installed using SMJobBless (). Not surprisingly, the hard part here is code signing. The least obvious part for me was that the SMAuthorizedClients and SMPrivilegedExecutables entries in the Info plist files of each application depend on the identity / certificate you used to sign the application. There is also a trick with the compiler / linker to get the Info plist file compiled into a helper tool , which will be a single executable file, not a package.
Once you launch the helper application, you must develop a way to communicate with it, as these are two different processes. XPC is one option, perhaps the easiest. XPC is commonly used with server processes, but what you use here is just the communication side of XPC. It basically transfers dictionaries between two applications. Create a standard format for the dictionary. I used @ "action", @ "source" and @ "destination" with 3 different action values, @ "filemove", @ "filecopy" and @ "makedirectory". These are three things that my helper application can do, and I can easily add more if necessary.
The helper application will basically configure the XPC connection and event handler and wait for the connection and commands. Commands will be just a dictionary, so you check the appropriate keys / values ββand do whatever.
I can provide more detailed information and a code if you need additional help, but this issue is 9 months, so I do not want to waste time providing you with information that you have already found out.
harrisg
source share