There are a total of 4 background process types on Mac. For details, refer to designing daemons and services. You can use launch daemon to start the service without relying on users.
Create launch daemon
Run xcode to create a simple command line ApplicationWebtwainservice.
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]){ @autoreleasepool { // insert code here... NSLog(@"Hello, World!"); } while (1) { sleep(100); } return 0;}
SetCom. dynamsoft. webtwainservice. plistPut in/Library/launchdaemons.
To successfully register a service, you must also modify the directory permission:Sudo chown root/library/launchdaemons/COM. dynamsoft. webtwainservice. plist.
EnterSudo launchctlRun launchd
Registration ServiceLoad-D system/library/launchdaemons/COM. dynamsoft. webtwainservice. plist. Then we can see that the service is loaded:
Enter list to view running processes.
Restart the system, and then open the log/var/log/webtwain. log to check whether the service is running:
How to create a service process on Mac OS X