Set the environment variable path as C:\msys64\ucrt64\bin in case if you have installed gcc using pacman -S mingw-w64-ucrt-x86_64-gcc.

OR

You can install gcc using: pacman -S mingw-w64-x86_64-gcc and set environment variable path as C:\msys64\mingw64\bin.

Answer from Shiv Buyya on Stack Overflow
Discussions

bash: gcc command not found - Apple Community
I have installed xcode 3.2 and it did not solve the problem. please help asap. Thanks ... Xcode should have done the trick. Any chance you modified your PATH environment variable? ... I haven;t done anything but installing xcode. Harsh ... gcc is in /usr/bin. Very odd it can't be found. More on discussions.apple.com
🌐 discussions.apple.com
November 21, 2010
GCC not found
Try sudo apt install build-essential it has dependencies for GCC, G++, make, libc-dev etc it's kind of odd that you don't already have it installed More on reddit.com
🌐 r/Ubuntu
4
0
February 19, 2024
gcc installed successfully but its Command not found | The FreeBSD Forums
I have install gcc successfully using: lang/gcc44 And I also tried also: pkg install gcc But when I try to use it the following appears: gcc: Command not found. When I issue pkg install gcc it shows: Updating repository catalogue gcc-4.6.4 already installed I am using FreeBSD 10.0. More on forums.freebsd.org
🌐 forums.freebsd.org
February 20, 2014
Can't seem to make MSYS2 GCC work at all
I know this doesn’t answer your question, but I struggled a lot with getting it all set up as well. I found it much easier to just install WSL and I can open that in a terminal window inside of VSCode and compile all my C or C++ programs. If you absolutely need to get MYSYS2 working, good luck. I’ll be checking back on this thread. More on reddit.com
🌐 r/learnprogramming
15
1
June 4, 2023
🌐
Apple Community
discussions.apple.com › thread › 2655687
bash: gcc command not found - Apple Community
November 21, 2010 - What happens when you type /usr/bin/gcc ? If it still can't be found I would guess you didn't install Xcode properly (Unix Development Support?) ... I just fell on this forum, I have the same problem: I found gcc: it appears it has been moved during installation of developer tools to the location: /Developer/usr/bin, (from /usr/bin) so I tried to launch gcc by typing the whole path /Developer/usr/bin/gcc, with a source file.c.
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › redhat-issue-bash-gcc-command-not-found-4175450121
Redhat issue: "bash:gcc command not found"
February 14, 2013 - I have been trying to compile my c program on redhat 6 installed with VMWARE app on my win7. When i tried gcc filename.c it barfed: bash:gcc command
🌐
iO Flood
ioflood.com › blog › install-gcc-command-linux
Installing and Using the GCC Command: Linux User Guide
January 2, 2024 - For RPM-based distributions like CentOS, you would run the command sudo yum install gcc. # For Debian based distributions like Ubuntu sudo apt-get install gcc # For RPM-based distributions like CentOS sudo yum install gcc # Output: # 'gcc is already the newest version (4:7.4.0-1ubuntu2.3).' # OR # 'Package gcc is not available, but is referred to by another package...'
Find elsewhere
🌐
Delft Stack
delftstack.com › home › howto › linux › solve gcc command not found error in bash
How to Solve GCC Command Not Found Error in Bash | Delft Stack
March 11, 2025 - For example, if GCC is located in /usr/local/bin/gcc, you would add the following line to your .bashrc or .bash_profile: ... Now, try running the gcc --version command again. If everything is set up correctly, you should see the version number without any errors. Encountering the “gcc command not found” error in Bash can be a common hurdle for developers, but it is usually easy to fix.
🌐
FreeBSD
forums.freebsd.org › ports and packages › installation and maintenance of ports or packages
gcc installed successfully but its Command not found | The FreeBSD Forums
February 20, 2014 - Edit: Forgot to mention; obviously ... everything should work normally once again. Click to expand... gcc is not part of FreeBSD 10 so the commands won't be there....
🌐
Reddit
reddit.com › r/learnprogramming › can't seem to make msys2 gcc work at all
r/learnprogramming on Reddit: Can't seem to make MSYS2 GCC work at all
June 4, 2023 -

the instalation of GCC seemed to work fine, but when i run gcc -- version, i get greeted by "bash:gcc: command not found" response. i followed the instructions with every step. what could be the issue?

I found a fix thanks to chatgpt ( who would've thought). turns out the MSYS2 link from the vs code page was simply outdated, so i used this one from the MSYS2 page and ran the commands in the ucrt window. I will leave this here in hopes someone else finds and needs this

🌐
Stack Overflow
stackoverflow.com › questions › 61713451 › using-git-bash-unable-to-compile-c-code-gcccommand-not-found
Using Git Bash unable to compile C code: "gcc:command not found" - Stack Overflow
I then copied the bin folder from MinGW into the mingw64 (C:\Program Files\Git\mingw64\bin) bin folder - which then recognized gcc as a command. One issue to note that I am still having, is when I try to compile files and create object files using the -o flag, I am not creating anything. I'm still looking into this, but I hope some of this instruction helped to at least get the command recognized. Some useful links: https://yichaoou.github.io/tutorials/software/2016/06/28/git-bash-install-gcc#:~:text= How to install gcc in Git Bash,you want to click on Apply.
🌐
Stack Overflow
stackoverflow.com › questions › 20164032 › bash-gcc-command-not-found-mavericks › 21794232
macos - -bash: gcc: command not found - Mavericks - Stack Overflow
February 15, 2014 - If the command isn't found but you know it exists on your system, you need to modify your shell's PATH environment variable to include the directory that contains it. I'm not sure what you're trying to convey with your ls command -- what are ...
🌐
Reddit
reddit.com › r/linuxquestions › linux from scratch: chapter 5.3 x86_64-lfs-linux-gnu-gcc: command not found
r/linuxquestions on Reddit: Linux From Scratch: chapter 5.3 x86_64-lfs-linux-gnu-gcc: command not found
March 7, 2021 -

Hello, when i enter

cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h

at gcc-10.2.0 i get the error message:

bash: x86_64-lfs-linux-gnu-gcc: command not found
dirname: missing operand
Try 'dirname --help' for more information
bash: /install-tools/include/limits.h: No such file or directory

I tried re-making everything in chapter 5.3 and got the error (at the make process): [Makefile:12848: configure-target-libcc] Error 1 and [Makefile:945: all] Error 2.

Any ideas?

🌐
Gentoo Forums
forums.gentoo.org › viewtopic.php
Gentoo Forums :: View topic - gcc: command not found
FAQ | Search | Memberlist | Usergroups | Statistics | Profile | Log in to check your private messages | Log in | Register · Links: forums.gentoo.org | www.gentoo.org | bugs.gentoo.org | wiki.gentoo.org | forum-mods@gentoo.org
🌐
Bash Commands
bashcommands.com › bash-gcc-command-not-found
bash Gcc Command Not Found: Quick Fixes and Tips
May 13, 2025 - The error "bash: gcc: command not found" indicates that the GCC (GNU Compiler Collection) is not installed on your system or is not in your system's PATH, which can be resolved by installing it or ensuring it's correctly configured.
🌐
GitHub
github.com › msys2 › setup-msys2 › issues › 118
"command not found" when trying to call CMake or GCC after installing them · Issue #118 · msys2/setup-msys2
March 16, 2021 - $ pacman -S mingw-w64-i686-cmake mingw-w64-i686-gcc · Now, try to use CMake: $ cmake bash: cmake: command not found · or GCC: $ gcc bash: gcc: command not found · These commands worked in previous versions of MSYS, so I'm not sure if it is a bug in MSYS of something wrong I'm doing.
Author   silvioprog
🌐
GitHub
github.com › rdp › ffmpeg-windows-build-helpers › issues › 95
/bin/sh: gcc: command not found · Issue #95 · rdp/ffmpeg-windows-build-helpers
October 31, 2015 - To fix this, i went back to Cygwin setup, and installed a bunch of gcc untill one of them installed gcc.exe into /bin/ of the local install of cygwin.
Author   teebu