63

Sandboxed apps have to declare their entitlements. Of course, that doesn't do me any good if I can't tell what entitlements it declares. A text editor that has entitlements for Core Location, Network Server, and my Address Book, without my knowledge, could be much worse than an unsandboxed app.

How can I see what entitlements an app has?

1 Answer 1

93

After some more searching, I found a command-line answer:

codesign -d --entitlements - --xml /Applications/Whatever.app

This will print out an XML plist with values like:

<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>

For more information see https://developer.apple.com/library/archive/qa/qa1798/_index.html#//apple_ref/doc/uid/DTS40014167-CH1-IOS_STEPS

If anyone knows an easier/nicer way, though, I'd love to hear it.

10
  • 2
    Also more documentation about that: developer.apple.com/library/content/documentation/Security/…
    – user202579
    Commented May 15, 2018 at 9:42
  • On Mojave 10.14.4, the command above prints an extra 8 bytes at the start: fade7171000000fb, making the XML invalid. Any way to avoid that or strip it away?
    – luckman212
    Commented Apr 22, 2019 at 15:03
  • codesign -d --entitlements - <filepath> 2>&1 | LANG=C LC_CTYPE=C sed 's/^.*\<\?xml/\<\?xml/g' | grep "<.*>" Maybe there's another solution, but that's how I strip those bytes. But I don't think it's necessary: you can codesign an app by pointing to an entitlements xml, and macOS will ignore those bytes anyway.
    – JayB
    Commented May 18, 2019 at 6:29
  • 3
    Add a colon to omit those bytes: codesign -d --entitlements :- /Applications/Whatever.app/
    – artyom.stv
    Commented Jul 1, 2019 at 14:32
  • 1
    @VioletGiraffe There's now a --xml switch which is much clearer than the colon, which is now deprecated. Commented Mar 25, 2023 at 13:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .