Please tell me a way grant for my application to modify /Library/Fonts folder as add new and remove font file. Thanks in advance.
Asked
Active
Viewed 1,116 times
1 Answers
1
- You can split your application into two parts: service(daemon) and UI and install them via installer in the way so your service will have root privileges
- You can run some command from your app using
AuthorizationExecuteWithPrivileges()
but it is deprecated. Still it works - You can run some command via
NSAppleScript
using "do shell script \"some script\" with administrator privileges". But it more like a hack and apple documentation says thatNSAppleScript
class must be used only from the main thread of an application. But it works too, and personally I don't have any troubles with that. - You can create helper tool and use
ServiceManagement.framework
andSMJobBless()
-
Upvote for splitting the app with a helper app. Apple has example code here: http://developer.apple.com/library/mac/#samplecode/SMJobBless/Introduction/Intro.html – TheDarkKnight Jul 18 '13 at 07:45
-
But I build SMJobBless project on XCode 3.2 and Mac OS 10.6 get error ` Undefined symbols: "_CFBridgingRelease", referenced from: -[SMJobBlessAppController blessHelperWithLabel:error:] in SMJobBlessAppController.o ld: symbol(s) not found collect2: ld returned 1 exit status ` – PVA Jul 18 '13 at 08:04
-
See requirements: http://developer.apple.com/library/mac/#samplecode/SMJobBless/Introduction/Intro.html – cody Jul 18 '13 at 08:10
-
How to authorization grant write to /Library/Fonts folder with AuthorizationExecuteWithPrivileges() – PVA Jul 19 '13 at 09:00
-
You are passing your script to `AuthorizationExecuteWithPrivileges`. It may be either launch of some your helper script/tool, or just calling the `rm` or `cp` utilities – cody Jul 19 '13 at 09:04
-
I use Mac 10.4 SDK, i try to use kAuthorizationRightExecute = "system.privilege.admin" but not write that folder font. Have a grant as privilege root or not? – PVA Jul 19 '13 at 09:28
-
I don't know about 10.4 SDK. And by the way, why do you need /Library/Fonts? Why don't use ~/Library/Fonts? You wouldn't need any specific privileges for this. – cody Jul 19 '13 at 09:41