You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VSCode terminal doesn't allow/request permissions to access media devices #95062
The result will be Abort trap: 6. This also occurs if you try to run the debugger.
The script does work in the Mac Terminal and iTerm.
This is likely because vscode does not have permissions to access the camera. There is no way to force vscode to appear in the Mac permissions (Security & Privacy -> Privacy -> Camera), such that it cannot be enabled by the user.
Does this issue occur when all extensions are disabled?: Yes
Jasper van Heugten, PhD (@jvanheugten) your assumption is correct. But if your macOS terminal app got the permissions to access camera, then any process spawned from it should get that. I am unable to reproduce the crash with the terminal from inside code after I grant the terminal access to camera.
Here is a simple demonstration. Mac OS Terminal shows the correct result, but terminal in VSCode does not.
Does VSCode spawn a emulated terminal? If MacOS thinks it is VSCode that spawns it, I would expect a permission request to access the camera, but that never happens. My privacy settings do show that Terminal has access to the camera, but there is no way to add VSCode to that list.
Reacted by CHHORN Ponleu, Daniel, Taras Novak and Yash Saraswat
My privacy settings do show that Terminal has access to the camera, but there is no way to add VSCode to that list.
Yes you can't do that at the moment, because code doesn't carry the entitlement that requests access to camera. I am looking to avoid adding this unless necessary, but for the current use case through the terminal things should work the way it is.
Just ran VSCode as administrator: sudo /Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron
Then my terminal in VSCode will run as root and the program executes as normal.
Of course, that is not a real solution though, but it shows some permissions are not handled correctly.
Thanks for the context, based on #95062 (comment) since we execvp, macOS tcc utility will consider the permissions of the parent process instead of the forked process.
But I am still confused why it wasn't an issue with my setup, moving this next milestone for further investigation.
mattialibera No, I used the tccutil tool.
I got it working now, by using the SQL INSERT commands directly.
A couple of things that may help someone else:
There is a typo in your SQL command for Catalina where is says "com.microsoft.VSCoda".
My biggest problem was that I could not read the TCC.db file or even list that directory until after I booted into Recovery mode and turned off SIP. What I really should have done was to turn on Full disk access for Terminal, but I didn't know that.
I have written a script in Python3 for speech recognition. When I run this script in VSCode internal terminal, I can't pick up any signal from the microphone. Then I tried to run my script natively in MAC terminal, it works after accepting the permission for microphone.
I tried again in VSCode internal terminal and same problem as before. No signal from the microphone.
I miss the permission for microphone in the VSCode terminal.
I tried out the way by Wolf Rogner (@wrogner) with no success at first.
Then i found Comment: #95062 (comment)
"""
Also, before running the above comments, you need to grant Full Disk Access to Terminal.
You can do so at: System Preferences -> Security & Privacy -> Privacy tab -> Full Disk Access row in left sidebar
"""
That was the key. Now i can get data from microphon in VSCode.
If things still don't seem right, please ensure you're on version 0123d26 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.
Activity
vscodebot commentedon Apr 12, 2020
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
jvanheugten commentedon Apr 12, 2020
Probably both issues have similar origin, namely camera permissions are not set for vscode.
deepak1556 commentedon Apr 13, 2020
Jasper van Heugten, PhD (@jvanheugten) your assumption is correct. But if your macOS terminal app got the permissions to access camera, then any process spawned from it should get that. I am unable to reproduce the crash with the terminal from inside code after I grant the terminal access to camera.
Can you share a video demo ?
jvanheugten commentedon Apr 14, 2020
Here is a simple demonstration. Mac OS Terminal shows the correct result, but terminal in VSCode does not.
Does VSCode spawn a emulated terminal? If MacOS thinks it is VSCode that spawns it, I would expect a permission request to access the camera, but that never happens. My privacy settings do show that Terminal has access to the camera, but there is no way to add VSCode to that list.
deepak1556 commentedon Apr 14, 2020
Have your restarted code after giving your macOS terminal access to camera ? Otherwise code wouldn't pick up the privilege for the terminals it opens.
Daniel Imms (@Tyriar) how do we spawn terminals on macOS ?
I tried the following steps and it seems to work , https://streamable.com/zsa8ro
Yes you can't do that at the moment, because code doesn't carry the entitlement that requests access to camera. I am looking to avoid adding this unless necessary, but for the current use case through the terminal things should work the way it is.
jvanheugten commentedon Apr 14, 2020
Yes, I've restarted vscode a couple of times. I'll try uninstalling and reinstalling it from scratch tomorrow.
Tyriar commentedon Apr 15, 2020
Robo (@deepak1556)
https://github.com/microsoft/node-pty/blob/cd72d3303cb484e402381741e7e6a613886eda7b/src/unix/pty.cc#L441
jvanheugten commentedon Apr 15, 2020
I just completely uninstalled VSCode and re-installed it and restarted my computer. The problem is still there.
I even deleted everything according to similar paths here: https://stackoverflow.com/questions/42603103/how-to-completely-uninstall-vscode-on-mac
jvanheugten commentedon Apr 15, 2020
Just ran VSCode as administrator:
sudo /Applications/Visual\ Studio\ Code.app/Contents/MacOS/ElectronThen my terminal in VSCode will run as root and the program executes as normal.
Of course, that is not a real solution though, but it shows some permissions are not handled correctly.
deepak1556 commentedon Apr 15, 2020
Thanks for the context, based on #95062 (comment) since we
execvp, macOS tcc utility will consider the permissions of the parent process instead of the forked process.But I am still confused why it wasn't an issue with my setup, moving this next milestone for further investigation.
44 remaining items
adgbu commentedon Mar 12, 2021
mattialibera No, I used the tccutil tool.
I got it working now, by using the SQL INSERT commands directly.
A couple of things that may help someone else:
Thanks for taking the time to answer.
HoBu23 commentedon Mar 13, 2021
macOS Big Sur, version 11.2.3.
I have written a script in Python3 for speech recognition. When I run this script in VSCode internal terminal, I can't pick up any signal from the microphone. Then I tried to run my script natively in MAC terminal, it works after accepting the permission for microphone.
I tried again in VSCode internal terminal and same problem as before. No signal from the microphone.
I miss the permission for microphone in the VSCode terminal.
I tried out the way by Wolf Rogner (@wrogner) with no success at first.
Then i found Comment: #95062 (comment)
"""
Also, before running the above comments, you need to grant Full Disk Access to Terminal.
You can do so at: System Preferences -> Security & Privacy -> Privacy tab -> Full Disk Access row in left sidebar
"""
That was the key. Now i can get data from microphon in VSCode.
Thanks Wolf Rogner (@wrogner) and Samagra Singh Tomar (@sst2010)
wrogner commentedon Mar 13, 2021
Horst Buttkau (@HoBu23) : Please read the suggested solutions (and verify them) before submitting an addition.
Solutions for > 10.15.x by Wolf Rogner (@wrogner)
Solutions for < 10.15.x by mattialibera
HoBu23 commentedon Mar 13, 2021
okay, thanks for your info, but I have no success with Wolf Rogner (@wrogner) way. Problem with open .db in sqlite3. But with comment from Samagra Singh Tomar (@sst2010) it works.
Now I tried it in IntelliJ IDEA.
This is the result:

I think Microsoft should still think about this
vscode-triage-bot commentedon Apr 29, 2021
This bug has been fixed in the latest release of VS Code Insiders!
Jasper van Heugten, PhD (@jvanheugten), you can help us out by commenting
/verifiedif things are now working as expected.If things still don't seem right, please ensure you're on version 0123d26 of Insiders (today's or later - you can use
Help: Aboutin the command palette to check), and leave a comment letting us know what isn't working as expected.Happy Coding!
chore: add media and apple event entitlements