Install GCC on M1/M2 ARM Based Mac

Install GCC on M1-M2 ARM based Mac


Make sure you have homebrew installed on your Mac device.

⛏️ How to install Brew on M1/M2 Mac

The quickest way to get GCC on the M1/M2 ARM based Mac is using brew.

% brew search gcc
==> Formulae
aarch64-elf-gcc     gcc@11              gcc@6               gcc@9               x86_64-elf-gcc      scc
gcc                 gcc@4.9             gcc@7               i686-elf-gcc        ghc                 tcc
gcc@10              gcc@5               gcc@8               libgccjit           grc                 ncc

==> Casks
gcc-aarch64-embedded          gcc-arm-embedded              gcs                           icc
% brew install gcc

==> Downloading
==> Installing dependencies for gcc: gmp, isl, mpfr, libmpc, lz4 and zstd
==> Installing gcc
==> Pouring gcc--12.2.0.arm64_monterey.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/gcc/12.2.0: 1,470 files, 358.9MB
==> Running `brew cleanup gcc`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

As you can see, the version installed is the ARM64 one!

% gcc -v
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin22.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Have Questions? Post them here!
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.