gcc --version
This will give output like:
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
brew install gcc
/opt/homebrew/Cellar/gcc/15.1.0/
.bin
directory and check the GCC version:gcc-15 --version
This should point to the Homebrew version.
bin
directory:cd /opt/homebrew/bin
ln -s gcc-15 gcc
ln -s g++-15 g++
gcc
or g++
is pointing to:where gcc
Example output:
/opt/homebrew/bin/gcc
/usr/bin/gcc