Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`"<program>" would like to access files in your Documents folder` message with VS Code and macOS Catalina

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.

like image 735
swineone Avatar asked Apr 23 '20 18:04

swineone


People also ask

How do I allow access to files and folders on Mac?

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.

What is the Documents folder in Mac OS and Windows?

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.

How do I find the Documents folder on a Mac?

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.


1 Answers

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.

like image 68
tanto_ Avatar answered Sep 20 '22 13:09

tanto_