Trying to use /usr/bin/gcc instead of Xcode clang for purposes of C++20

22 hours ago 3
ARTICLE AD BOX

On Macs g++/gcc are just wrappers to clang.

Unless you have explicitly gone and found and installed g++/gcc you are using clang.


Looking at your path:

/usr/bin/gcc /opt/homebrew/opt/node@22/bin /opt/homebrew/opt/ruby/bin /opt/homebrew/bin /opt/anaconda3/condabin /opt/homebrew/opt/node@22/bin /opt/homebrew/opt/ruby/bin /opt/homebrew/bin /Library/Frameworks/Python.framework/Versions/3.14/bin /Library/Frameworks/Python.framework/Versions/3.14/bin /Library/Frameworks/Python.framework/Versions/3.14/bin /Library/Frameworks/Python.framework/Versions/3.13/bin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin /opt/pkg/env/active/bin /opt/pmk/env/global/bin /Library/Apple/usr/bin /usr/local/go/bin PATH is seporated by ':' not white space (lets assume you did that manually). This is wrong: /usr/bin/gcc You probably meant /usr/bin/

You can see which app your shell is picking up with: which

> which g++ /usr/bin/g++

If you don't trust that you can check if its a symbolic link:

> ls -la /usr/bin/g++ -rwxr-xr-x 78 root wheel 118880 Feb 24 19:41 /usr/bin/g++

If you don't want to chance the shell not finding the correct version you can be explicit and use the full path:

> touch x.cpp > /usr/bin/g++ --version x.cpp Apple clang version 21.0.0 (clang-2100.0.123.102) Target: arm64-apple-darwin25.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Unless you have installed g++/gcc explicitly (probably means building it), then what is installed by default is clang++/clang.

Loki Astari's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Read Entire Article