Run C++ Program on Mac OS X

45
views
(Last Updated On: September 1, 2018)

In this tutorial, you’ll learn in Detail how to Run C++ Program on Mac OS.

The easiest way to Run C++ Program on Mac OS X is by downloading XCode.

  1. Go to the download page of apple developer site.
Run C++ Program on Mac OS
source Programiz

 

2. Click the download Xcode link. It’s recommended to download the latest version even if it’s in beta.

3. Whe the download is completed, open Xcode and follow the wizard to install it. You might want to put the Xcode in Applications for future use.

4. Then, open Xcode and go to File > New > Project

Run C++ Program on Mac OS
source Programiz

 

5. Under OS X section, choose Application, choose Command Line Tool and hit next.

Run C++ Program on Mac OS
source Programiz

 

6. Provide the Product Name, for example: Hello. And, choose C++ under Language section. Then, click next.

Run C++ Program on Mac OS
source Programiz

 

7. Choose the location where you want to save the project in your Mac. You can uncheck Create Git repository button and click create.

8. Navigate to main.cpp file in the screen where you can see default code provided by XCode.

Run C++ Program on Mac OS
source Programiz

 

9. Change the code as you wish. And finally to run the code, go to Product > Run or simply hit Cmd + R.

10. By default, you will see the output at the bottom of your screen.

Read Next