How to Install GCC on macOS Tahoe — Xcode CLT and Homebrew

This guide shows you how to install GCC on macOS Tahoe so you can compile and run C programs from the Terminal. There are two methods — pick the one that suits you:

  • Method 1 — Xcode Command Line Tools (recommended for beginners): one command, installs Apple’s Clang compiler under the name gcc. No account needed.
  • Method 2 — Homebrew: installs actual GNU GCC alongside Clang. Better if you need the latest GCC version or are following a course that requires it specifically.

Not ready to install anything yet? You can write and run C programs directly in your browser — see our guide to online C compilers instead. No installation needed.

What You Are Actually Installing

On macOS, typing gcc in the Terminal runs Apple’s Clang compiler, not GNU GCC. Apple ships Clang under the gcc name because it is fully compatible for standard C programs. For learning C — and for everything on this site — Clang works perfectly. The only time you need actual GNU GCC is if a specific project or course requires it by name.

Prerequisites

  • A Mac running macOS Tahoe (these steps also work on Sequoia and Sonoma)
  • Terminal — open it from Applications → Utilities → Terminal, or press ⌘ Space and type Terminal
  • An internet connection for the download

Method 1 — Xcode Command Line Tools (Recommended)

This is the official Apple way. It installs Clang, Make, Git, and other developer tools in one shot.

Step 1 — Run the install command

Open Terminal and type:

xcode-select --install

A dialog box appears asking you to install the Command Line Developer Tools. Click Install, then Agree to the licence. The download is around 1–2 GB and takes a few minutes.

Step 2 — Verify the installation

gcc --version

You should see something like:

Apple clang version 17.0.0 (clang-1700.0.xx.x)
Target: arm64-apple-darwin26.0.0
Thread model: posix

The version numbers will vary. As long as you see a response without an error, GCC (Clang) is installed and ready.

Step 3 — Test with a quick C program

Create a file called hello.c:

#include <stdio.h>

int main(void) {
    printf("Hello from macOS Tahoe!\n");
    return 0;
}

Compile and run it:

gcc hello.c -o hello
./hello

Output:

Hello from macOS Tahoe!

That is all you need. Skip to What’s Next below.

Method 2 — Homebrew (Actual GNU GCC)

Homebrew is a package manager for macOS. It installs GNU GCC as gcc-14 (or the current version number) alongside Apple’s Clang.

Step 1 — Install Homebrew

If you do not have Homebrew yet:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the on-screen prompts. On Apple Silicon Macs, Homebrew installs to /opt/homebrew/. The installer will tell you to add Homebrew to your PATH — run the two eval lines it shows you, or add them to your ~/.zshrc.

Step 2 — Install GCC

brew install gcc

Step 3 — Verify

gcc-14 --version
gcc-14 (Homebrew GCC 14.x.x) 14.x.x
Copyright (C) 2024 Free Software Foundation, Inc.

Note: Homebrew installs GNU GCC as gcc-14 (or gcc-15 depending on the current version), not plain gcc, so Apple’s Clang remains the default. Use gcc-14 explicitly when you need GNU GCC, and gcc for Apple Clang.

Apple Silicon vs Intel Macs

Apple Silicon (M1/M2/M3/M4) Intel Mac
xcode-select method Works — target is arm64 Works — target is x86_64
Homebrew path /opt/homebrew/ /usr/local/
gcc –version output Shows arm64-apple-darwin Shows x86_64-apple-darwin
C programs compile Yes, natively Yes, natively

Both work fine for learning C. The compiled programs run on your specific chip architecture.

Common Issues

Problem Fix
xcode-select: error: command line tools are already installed You already have them — run gcc --version to confirm
xcrun: error: invalid active developer path Run xcode-select --reset then try again
Dialog never appears after xcode-select --install Check System Settings → Software Update for a pending CLT update
Homebrew: zsh: command not found: brew Add Homebrew to PATH — run the eval line the installer showed you

What’s Next

Now that GCC is installed, the next step is learning how to compile and run C programs from the Terminal — including how to handle multiple source files and compiler flags. See our complete guide: How to Run a C Program on macOS Tahoe.

If you want a full IDE with code completion and debugging instead of the bare Terminal, VS Code is the best free option for macOS and works great on Apple Silicon.

Once your environment is ready, browse our full list of C programs with examples to start practising.


As an Amazon Associate we earn from qualifying purchases.

Recommended Book

The best book to learn C once your environment is set up — The C Programming Language by Brian Kernighan and Dennis Ritchie (K&R). Concise, precise, and still the definitive reference 35 years on.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>