How do I run the application as root?
Please tell me how to provide my application to change / Library / Fonts folder as add new and delete font file. Thanks in advance.
0
PVA
source
to share
1 answer
- You can split the application into two parts, the service (daemon) and the user interface, and install them through the installer so that your service has root privileges.
- You can execute some command from your application with
AuthorizationExecuteWithPrivileges()
, but it is deprecated. Still it works - You can execute some command with using the
NSAppleScript
command "do shell script \" some script \ "with admin rights". But this is more like a hack and the Apple documentation says the classNSAppleScript
should only be used from the main thread of the application. But it works too and personally I have no problem with that. - You can create a helper tool and use
ServiceManagement.framework
andSMJobBless()
You can find more information here and here
+1
cody
source
to share