Tarek
Tarek

Reputation: 2392

NSFileManager 'copyItemAtPath:' creates quarantined file copies

I have a sandboxed OS X app where I copy a file from the app's /Contents/Resources/ folder to NSHomeDirectory(). All works well except that the copied file is marked as quarantined. Running xattr -l in terminal gives the following output:

$ xattr -l myfile
com.apple.quarantine: 0006;00000000;

How can I copy the file without having it being marked as quarantied, or worst case, how can I remove this attribute programmatically?

Upvotes: 2

Views: 462

Answers (1)

l'L'l
l'L'l

Reputation: 47302

OS X automatically quarantines certain files (executable, shell scripts, web archives, etc.) for sandboxed apps. There's an entitlement that you can manually include to prevent this:

com.apple.security.files.user-selected.executable

NOTE: This entitlement does not have an Xcode checkbox, and thus must be added to your app’s entitlement property list manually

App Sandbox Entitlement Keys

Upvotes: 2

Related Questions