would like to access files in your Desktop/Document/Download folders


I need how to access folders (Desktop/Document/Download) programatically wihout alert i.e “Sample App” would like to access files in your Desktop/Document/Download etc folders.

Replies

That alert is a system security feature, meaning that there should be no way to bypass it without user consent (if there were, that’d be considered a security bug). For more background on this, see WWDC 2019 Session 701 Advances in macOS Security.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • How can I get that prompt to appear? I see other apps do it and then they get added to Privacy - Files and Folders which is what I want, but my app just fails with a permissions error.

Add a Comment
I just asked a similar question. But, my issue, is that I can say NO & my installer still runs. So, can I just say no somewhere? I dont know what is accessing that folder & it still installs
$ cd /Volumes/mypackage
$ installer -pkg ./mypackage.pkg -target /Applications

Works. So it is something in "installer" when I double click on my install

but my app just fails with a permissions error.

To start, please read On File System Permissions and specifically the discussion of responsible code.

There are various things that can prevent TCC from determining the responsible code for these operations, and thus not generate this alert. Two questions:

  • Is this request being done by your main app? Or by some other other process, like a helper tool?

  • Is your main app’s executable a Mach-O executable? Or perhaps a script of some form? (The latter is common in Java apps.)

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"