您的位置:首页 > 运维架构 > Shell

How to Run a Shell Script with Mac App Sandbox Enabled?

2014-08-15 09:35 561 查看
Is it possible to have an app, that runs within the sandbox, execute a shell script? The script makes use of two basic commands:
defaults write
killall


I know that there are some exceptions to the sandbox, that can be added via the entitlements file, but not sure wheter it would be possible to have the user confirm the execution of the small script and then run it?

Please give me a practical hint... When I run my app with sandbox off, everything works fine. With sandbox on both commands are not working and this is shown in the console:
killall: warning: kill -TERM 12322: Operation not permitted


osx shell mac-app-store appstore-sandbox
share|improve
this question
edited Apr
24 at 7:36




mahal tertin

1,087718

asked Nov 12 '13 at 19:17





Ben Marten

581316

add
a comment


1 Answer

activeoldestvotes

up
vote1down
voteaccepted
Why would you want to sandbox such a powerful App it in the first place? Do you want to modify defaults and killall for specific other apps (somehow possible) or for "all that exist on the machine"?

If for specific other apps, why not do it without shell? For defaults write use com.apple.security.temporary-exception.shared-preference.read-write and add the domains you'd like to modify (eg. com.apple.DigitalColorMeter) and use CFPreferencesSetValue()

For killall use com.apple.security.temporary-exception.apple-events and run an Applescript / send AppleEvents to terminate specific processes.

share|improve
this answer
answered Nov 13 '13 at 12:47




mahal tertin

1,087718

Hey, I guess your answer sounds very good... Let me check it in the next days and I give you credit ;) – Ben
Marten Nov
14 '13 at 17:23
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: