How to Solve GCC Command Not Found Error in Bash
The GNU Compiler Collection, also known as GCC, comprises compilers and development tools available for Linux, Windows, and other operating systems.
This article will discuss installing the GCC and solving the bash: gcc: command not found
error in Linux Bash.
You can use the GCC tool to compile programs written in languages such as C. If you get the bash: gcc: command not found
error when using this command, the GCC tool is not installed correctly.
The rest of the article will explain how to download the GCC tool.
Install the GCC Tool for Linux
Install the GCC tool on different operating systems with the following commands.
for Arch Linux/Manjaro
Install the whole package, including the GCC tool.
sudo pacman -S base-devel
Alternatively, you can install just the GCC package.
sudo pacman -S gcc
for Ubuntu
Install the whole package, including the GCC tool.
sudo apt install build-essential
Alternatively, you can install just the GCC package.
sudo apt install gcc
Install the GCC Tool for Cygwin
First, you need to download the Cygwin setup-x86_64.exe
from here and launch it.
Press the Next button until you see the Cygwin Installation - Select Packages box and make the setting such as selecting the necessary root directories for installation.
Enter gcc
in the Search box, find the gcc-core
package in the Package column in the list, and change the combo box in the New column from Skip to the GCC version.
After clicking the Next button, you will see the Cygwin Installation - Review and confirm changes
dialog. If you notice other packages besides gcc-core
, you can leave them unchanged but ensure that gcc-core
is presented in the change list.
If you still get the bash: gcc: command not found
error after installation, add the ;C:\cygwin64\bin
to the PATH environment variable.
You can successfully install the GCC tool using the one that suits you best from these options. To check the installation, check the version of the tools.
gcc --version
If you can view the version information without error, you can use the gcc
command to compile code files.
Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.
LinkedIn