Ensure clang is installed:

clang --version

If it is not installed then try:

xcode-select --install

install vscode and then the following extension:

image.png

use to run the program : cmd + Shift + B

or can install coderunner extension