Gcc Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS

Gcc Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS

gcc

Preprocesses and compiles C and C++ source files, then assembles and links them together.

Maintainer: Debian GCC Maintainers


Section: devel

Install gcc

  • Debian apt-get install gcc Click to copy
  • Ubuntu apt-get install gcc Click to copy
  • Alpine OS apk add gcc Click to copy
  • Arch Linux pacman -S gcc Click to copy
  • Kali Linux apt-get install gcc Click to copy
  • CentOS yum install gcc Click to copy
  • Fedora dnf install gcc Click to copy
  • Raspbian apt-get install gcc Click to copy
  • macOS brew install gcc Click to copy

Preprocesses and compiles C and C++ source files, then assembles and links them together.

How to use gcc?

Below are few example commands for gcc that you can use in the terminal.

Compile multiple source files into executable:
gcc source1.c source2.c -o executableClick to copy
Allow warnings, debug symbols in output:
gcc source.c -Wall -Og -o executableClick to copy
Include libraries from a different path:
gcc source.c -o executable -Iheader_path -Llibrary_path -llibrary_nameClick to copy
Compile source code into Assembler instructions:
gcc -S source.cClick to copy
Compile source code without linking:
gcc -c source.cClick to copy
To install the latest version of gcc in your favorite operating system just copy the gcc installation command from above and paste it into terminal. It will download and install the latest version of gcc 2026 package in your OS.