How to install gcc in Git Bash (Windows)

Note: Git Bash in Windows cannot behave exactly the same as a linux bash. If you need to do the same in Windows, you may try CygWin.

To install GCC, the trick is to install MinGW installation manager.

  1. Go to MinGW SourceForge and download the file.

  2. Follow the instruction to install it.

  3. When you see MinGW Installation Manager Dialog, click on MSYS in the left sidebar, you will see mingw-developer-toolkit in the right side panel. Now just right click on it and select mark for installation.


  4. In the navigation bar, select Installation > Apply Changes. A new dialog will appear, you want to click on Apply.


  5. The last step is to go to Windows environment variable settings: Control Panel > System and Security > System.


  6. Click on Advanced system settings.


  7. Click on Environment Variables.


  8. Double Click on System variables > Path. Put ;C:\MinGW\bin\ into the Variable value. ; is the seperator.