I'm using Visual Studio Code with the C/C++ official extension from Microsoft to write C programs, running under macOS Catalina 10.15.3. The project folder lies in a path within the Documents folder on my home directory.
Every time I try to debug my code, a confirmation window pops up with the message "<program>" would like to access files in your Documents folder
. I have to click the OK button to proceed.
This slow downs my workflow, and is cluttering the list of allowed apps inside System Preferences => Security & Privacy => Privacy => Files and Folders (which, strangely, won't let me delete files from the list -- I'll ask a question about this in Ask Different later, but that's not the main issue: I want to get rid of this confirmation window altogether.)
Is there a way to go straight to a debug session without having to click OK on this message every time?
There's an issue in the C/C++ extension's GitHub issue tracker apparently about the same problem, and the suggested solution is to grant access to Terminal. However, this doesn't fix the issue for me -- in fact, access to the Documents folder was already granted to Terminal a long time ago since I use Terminal daily.
On your Mac, choose Apple menu > System Preferences, click Security & Privacy , then click Privacy. Select Files and Folders. Select the checkbox below an app to allow it to access files and folders in that location.
The Documents folder in Mac OS X resides in your Home folder (Macintosh HD / Users / YOU (short name for your user name - Home folder)) along with the folders for Music, Pictures, Videos and Downloads.
Click the Finder icon in the Dock. In the Finder sidebar, click Recents, iCloud Drive, Documents, or the folder where the document is located, then double-click the document's icon or name.
I've search high and low for a good solution to this that allows me to keep my project folders on my Desktop but haven't found anything. Apparently the Desktop, Documents, and Downloads files are just more strict now. I'm thinking macOS just thinks any change to a file that tries to access other files in these three folders is potentially nefarious and they try to play gatekeeper. It was obviously done as part of their security updates in moving towards tighter security but this is just such an unnecessary hiccup for developers.
Anyway, the only two solutions I've seen that work (I'm using Xcode, personally) is to move folders outside of the three folders I named earlier, or just run directly through the Terminal app rather than through an IDE. This obviously isn't perfect, but it works. I don't like not having my important projects on my Desktop anymore but until I find a better solution I guess that's what I'll do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With