For Mac users, two options are recommended for running C++ programs: Xcode and a command line C++ compiler.
-
Xcode:
-
Xcode is a software development tool used to create iOS apps. It is a user-friendly, powerful Integrated Development Environment (IDE) software tool.
-
It is highly recommended for C++ programming on Mac.
-
Command Line C++ Compiler:
-
A good choice is the g++ compiler. You can use a Terminal window to run the g++ compiler.
-
Your computer may not have g++ installed. Just type g++ in a Terminal window, and the system will prompt for installation.
-
For creating and editing your C++ programs, you can use a text editor. Microsoft Visual Studio Code (different from Visual Studio) is a great coding editor supporting almost all programming languages. However, it cannot compile and run programs directly. You need to install some extensions (plugins) to make it work.
Note that the software "Visual Studio on Mac" on Microsoft's website does not support C++.
Below is a screenshot showing how to compile and run C++ program using C++ compiler g++ on a Terminal window.