How to Install C Plus Plus (C++) on M1/M2 macOS

If you want to working with C++ (CPP) on your macOS with M1/M2 Mac then you can install it using Homebrew package manager.

The package that you need to install is called gcc, this will contain the GNU C++ compiler and binaries.

brew install gcc
Installing C++ on M1 - M2 Mac using brew on Mac

Note if you install Xcode on your M1/M2 Mac, you should have gcc already installed.

Macbook % gcc --version

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!