Skip to main content

GCC C Compiler

1 min read Updated May 29, 2025
Share:
On this page (7sections)

GNU GCC Compiler

The GNU Compiler Collection (GCC) is the standard C compiler on Linux and macOS, and the recommended choice for modern C development on Windows via MinGW-w64 through MSYS2.

Official resources

  1. Download and install MSYS2 from https://www.msys2.org/
  2. Open MSYS2 UCRT64 from the Start menu
  3. Update packages: pacman -Syu
  4. Install GCC: pacman -S mingw-w64-ucrt-x86_64-gcc
  5. Verify: gcc --version

To use gcc from Command Prompt or PowerShell, add C:\msys64\ucrt64\bin to your Windows PATH (adjust if you installed MSYS2 elsewhere).

For a full toolchain (make, gdb, etc.): pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

Linux

Most distributions include GCC in their package manager:

  • Debian / Ubuntu: sudo apt install build-essential
  • Fedora: sudo dnf install gcc
  • Arch: sudo pacman -S base-devel

Verify with gcc --version.

macOS

Install Xcode Command Line Tools (includes Clang, which supports C). For GCC specifically, install via Homebrew: brew install gcc

Quick test

#include <stdio.h>

int main(void) {
    printf("Hello, C!\n");
    return 0;
}

Compile: gcc hello.c -o hello then run ./hello (or hello.exe on Windows).

Related Tutorials

Search tutorials