I am trying to configure VS Code on an M1 Pro MacBook (Apple Silicon, macOS Tahoe) to debug a basic C program that requires user input via scanf.
Because the default cppdbg configuration has known limitations with externalConsole on macOS, I switched to the CodeLLDB extension ("type": "lldb"). I am attempting to use "terminal": "external" so that a native macOS Terminal window spawns to handle my program's stdin keyboard input.
However, when I start debugging, the external terminal fails to launch or show my code's output. Previously, when I tried using the "console" attribute, VS Code threw a "Property console is not allowed" error schema validation warning, which is why I am strictly using "terminal": "external" as defined in the CodeLLDB reference guide.
Here's my code in main.c :
#include
int main(){
int a = 0;
printf("Input your number:");
scanf("%d", &a);
printf("Hello World! %d\n", a);
}
This is my tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang build active file",
"command": "/usr/bin/clang",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang"
}
]
}
And my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"terminal": "external",
"cwd": "${fileDirname}"
}
]
}
Here's a screen recording of my problem:
https://drive.google.com/file/d/12NmLf3bhtdqLHzbupU-iqL94fDqB675T/view?usp=sharing
Any idea how to fix that? I looked that up but nothing worked for me and I asked AI and didn't manage to find the solution either.
Why is CodeLLDB ignoring or failing to open the native external Terminal window on Apple Silicon despite using the verified "terminal": "external" property string?