gcc: command not found
gcc: command not found
DodaTech
2 min read
The gcc: command not found error means the GNU C Compiler is not installed. It appears when trying to compile C programs but the compiler is missing.
What It Means
The shell cannot locate the gcc binary in any directory listed in your PATH environment variable. GCC is not installed by default on most systems — you need to install it explicitly for your platform.
Why It Happens
- GCC is not installed on the system at all
- You’re on a minimal system (Docker container, fresh OS install) without development tools
- On Windows, GCC isn’t included and requires MinGW or WSL
- The PATH does not include the GCC installation directory
How to Fix It
Step 1: Install GCC on Debian/Ubuntu
sudo apt update
sudo apt install gccVerify the installation:
gcc --versionStep 2: Install GCC on Fedora/RHEL
sudo dnf install gccStep 3: Install GCC on macOS
Install Xcode Command Line Tools which includes GCC:
xcode-select --installStep 4: Install GCC on Windows
Download MinGW-w64 from mingw-w64.org or use Chocolatey:
choco install mingwAlternatively, enable WSL (Windows Subsystem for Linux) and install GCC inside the Linux environment.
Step 5: Verify the installation
Create a test C program and compile it:
// hello.c
#include <stdio.h>
int main() {
printf("Hello, GCC!\n");
return 0;
}gcc hello.c -o hello
./helloExpected output:
Hello, GCC! Previous
fatal: not a git repository (or any of the parent directories): .git
Next
gem: command not found
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro