Gcc Installation On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS
Install gcc
-
Debian
apt-get install gccClick to copy -
Ubuntu
apt-get install gccClick to copy -
Alpine OS
apk add gccClick to copy -
Arch Linux
pacman -S gccClick to copy -
Kali Linux
apt-get install gccClick to copy -
CentOS
yum install gccClick to copy -
Fedora
dnf install gccClick to copy -
Raspbian
apt-get install gccClick to copy -
macOS
brew install gccClick 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 copyAllow warnings, debug symbols in output:gcc source.c -Wall -Og -o executableClick to copyInclude libraries from a different path:gcc source.c -o executable -Iheader_path -Llibrary_path -llibrary_nameClick to copyCompile source code into Assembler instructions:gcc -S source.cClick to copyCompile 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.




