Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
Redmond desk7 min

How to Install GCC in Windows 11 for Beginners

The beginner-friendly way to install native GCC on Windows 11 is MSYS2 with the UCRT64 environment. Learn the exact commands to install, verify, update, and use GCC.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a native GCC installation on Windows 11, the simplest current route is MSYS2 with the UCRT64 environment. It installs GCC, the MinGW-w64 Windows headers and libraries, build tools, and the pacman package manager in one setup.

You do not need to download a separate “MinGW” package or edit Windows PATH just to compile programs from the MSYS2 UCRT64 terminal. Follow the steps below to install GCC, verify it, and compile a small C program.

As an Amazon Associate I earn from qualifying purchases.

What you will install

MSYS2 is a Windows development distribution that provides native Windows compilers and Unix-style command-line tools. Its current recommended GCC environment is UCRT64, not the older MINGW64 environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Component Purpose
MSYS2 Provides the terminal, package manager, libraries, and development tools
UCRT64 64-bit native Windows GCC environment using Microsoft’s Universal C Runtime
pacman Installs and updates MSYS2 packages
gcc Compiles C source files
g++ Compiles C++ source files

Older tutorials often tell beginners to select MINGW64. That advice is outdated: MSYS2 changed its default environment to UCRT64 in 2022, and MINGW64 is scheduled for deprecation on March 15, 2026.

Check Windows 11 compatibility

MSYS2 requires 64-bit Windows 10 version 1809 or newer. Every supported Windows 11 installation meets that requirement, but your computer must still be running a 64-bit version of Windows.

To check, open Settings > System > About and look at System type. It should identify a 64-bit operating system and processor.

Step 1: Download MSYS2

  1. Open the official MSYS2 website.
  2. Download the installer matching your computer: the x64 installer for standard Intel or AMD Windows PCs, or the ARM64 installer for Windows on ARM.
  3. The current MSYS2 site lists msys2-x86_64-20260611.exe for x64 Windows and msys2-arm64-20260611.exe for ARM64 Windows. The filename may change when a newer release is published, so download from the official site rather than relying on an old copy.

Step 2: Install MSYS2

  1. Run the downloaded installer.
  2. On the Installation Folder screen, accept the default folder unless you have a specific reason to change it. The default is typically C:msys64.
  3. Continue through the installation wizard.
  4. Click Finish when the installation completes.

MSYS2 normally opens a UCRT64 terminal automatically after installation. If it does not, open the Start menu and launch MSYS2 UCRT64. This exact launcher matters; do not use ordinary Command Prompt, PowerShell, the plain MSYS terminal, or a manually launched sh.exe for the installation command.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 3: Install GCC

In the MSYS2 UCRT64 terminal, run:

pacman -S mingw-w64-ucrt-x86_64-gcc

MSYS2 will display the packages and dependencies that it plans to install. When it asks:

:: Proceed with installation? [Y/n]

press Enter. The default response is yes.

The package name is deliberately specific:

  • mingw-w64 identifies the Windows-targeting toolchain.
  • ucrt identifies the UCRT64 environment.
  • x86_64 identifies the 64-bit target.
  • gcc is the compiler package, which also supplies the C++ compiler command used in this environment.

Step 4: Verify the installation

Still in the MSYS2 UCRT64 terminal, run:

gcc --version

You should see GCC version information instead of a “command not found” message. Do not expect one permanent version number: MSYS2 is a rolling-release distribution, so the installed version changes as packages are updated.

To see the exact package version installed through pacman, run:

pacman -Qi mingw-w64-ucrt-x86_64-gcc | grep Version

You can also check the C++ compiler:

g++ --version

Step 5: Compile a C program

Create a file named hello.c. You can use Notepad, Visual Studio Code, or the terminal. Put this code in the file:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#include <stdio.h>

int main(void) {
    printf("Hello, Windows!n");
    return 0;
}

In the UCRT64 terminal, change to the folder containing the file. For example, if you saved it in your Windows Downloads folder, use:

cd ~/Downloads

MSYS2 maps your Windows user profile into the Unix-style home path. You can also access a drive directly, such as /c/Users/YourName/Documents.

Compile the file with:

gcc hello.c -o hello.exe

If compilation succeeds, GCC creates hello.exe in the same folder. Run it with:

./hello.exe

The expected output is:

Hello, Windows!

The -o hello.exe option specifies the output filename. Without it, GCC normally creates an output file named a.exe, which is less descriptive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compile a C++ program

For C++, save a source file as hello.cpp and compile it with g++ rather than gcc:

g++ hello.cpp -o hello.exe

Run the resulting Windows executable from the same terminal:

./hello.exe

The UCRT64 launcher configures the shell so that /ucrt64/bin is searched before the regular MSYS /usr/bin directory. That is why the correct compiler is found automatically when you use the supplied launcher.

Do you need to add GCC to Windows PATH?

No, not if you use GCC inside the MSYS2 UCRT64 terminal. The UCRT64 launcher sets the required environment automatically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You only need to add GCC to Windows’ own PATH if you want to run gcc from regular PowerShell, Command Prompt, or an IDE started outside MSYS2. With the default installation folder, add:

C:msys64ucrt64bin

On Windows 11, the usual route is:

  1. Open Settings > System > About.
  2. Click Advanced system settings.
  3. Click Environment Variables….
  4. Under User variables, select Path and click Edit. Using User variables avoids changing the setting for every account.
  5. Click New, enter C:msys64ucrt64bin, and confirm with OK on each dialog.
  6. Close and reopen PowerShell, Command Prompt, or your IDE.

Do not add C:msys64usrbin or the entire MSYS2 installation to Windows PATH. Exposing multiple MSYS2, Cygwin, MinGW, or other toolchain directories can make Windows select the wrong gcc, shell, linker, or DLL. If you use an external IDE, configure it to use the UCRT64 toolchain specifically.

Update MSYS2 correctly

MSYS2 is a rolling-release distribution and expects complete system upgrades. In the UCRT64 terminal, run:

pacman -Suy

A core update may ask to close all MSYS2 processes, including the current terminal:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
:: To complete this update all MSYS2 processes including this terminal will be closed.
   Confirm to proceed [Y/n]

Confirm the update. When the terminal closes, open MSYS2 UCRT64 again and run:

pacman -Suy

Run the command a second time because the first pass may update the MSYS2 runtime before the remaining packages can be updated. Avoid updating only GCC while leaving the rest of the MSYS2 installation outdated; partial upgrades are not the supported update model.

Fix common installation problems

“gcc: command not found”

Check the window title or prompt and make sure you opened MSYS2 UCRT64. The plain MSYS terminal is a different environment under /usr; it is not the native UCRT64 GCC terminal. Also confirm that the package installation completed:

pacman -Qi mingw-w64-ucrt-x86_64-gcc

If it is missing, run the installation command again from UCRT64.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You installed the wrong package

The current package name is:

mingw-w64-ucrt-x86_64-gcc

A package beginning with mingw-w64-x86_64- belongs to the older MINGW64 naming convention. Do not install a second unrelated MinGW distribution to compensate. Multiple toolchains commonly create PATH and library conflicts.

You launched sh.exe directly

Do not create a shortcut that runs sh.exe by itself. MSYS2 launchers set environment variables and start the appropriate login shell. Use the Start-menu shortcut for MSYS2 UCRT64.

PGP or maintainer-signature errors

If the installation has not been updated for roughly six months, package signatures may fail because the keyring is stale. First try:

pacman-key --refresh-keys

If MSYS2 reports that a new keyring is needed, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
pacman -Sy msys2-keyring
pacman -Suy

SSL certificate errors

On corporate networks, proxies and antivirus software may inspect HTTPS traffic and replace the website’s certificate with a company or antivirus certificate. MSYS2’s OpenSSL does not automatically use the Windows certificate store. Errors may include self signed certificate in certificate chain or unable to get local issuer certificate.

Contact your network administrator for the approved certificate or proxy configuration rather than disabling certificate verification. The problem is with the network’s TLS interception, not with the GCC package itself.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why MSYS2 UCRT64 is preferable to older guides

Older Windows GCC tutorials often combine an obsolete MinGW download, manual PATH changes, and separately downloaded DLLs. That approach makes it difficult to tell which compiler and runtime an IDE is using. MSYS2 keeps the compiler, libraries, and updates together, while UCRT64 provides the current recommended 64-bit GCC environment for Windows.

FAQ

Can I install GCC using Command Prompt or PowerShell?

You can use GCC from Command Prompt or PowerShell after adding C:msys64ucrt64bin to Windows PATH, but install it with pacman from the MSYS2 UCRT64 terminal. The UCRT64 launcher supplies the correct environment automatically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I choose MINGW64 or UCRT64?

Choose UCRT64 for a new installation. MINGW64 is the older environment and is being deprecated; current MSYS2 guidance recommends UCRT64 for users who are unsure which environment to select.

Where is the compiled EXE file?

Unless you specify another path, it is created in the current terminal folder. For gcc hello.c -o hello.exe, the output is hello.exe in the same directory as hello.c.

Why does Windows say the program cannot start because a DLL is missing?

This usually means the program is being run outside an environment that can find its runtime DLLs, or that mixed toolchains were used. Use the UCRT64 toolchain consistently and avoid adding unrelated MSYS2, Cygwin, or MinGW directories to PATH.

Does installing GCC also install an editor?

No. GCC is a compiler, not a code editor. You can write source files with Notepad, Visual Studio Code, or another editor, then compile them from the MSYS2 UCRT64 terminal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Bottom Line

Install MSYS2, open MSYS2 UCRT64, and run pacman -S mingw-w64-ucrt-x86_64-gcc. Verify with gcc --version, then compile with gcc hello.c -o hello.exe. Windows PATH changes are optional and are only needed when GCC must be launched from outside MSYS2.

For updates, use the complete MSYS2 upgrade command pacman -Suy rather than updating GCC in isolation.

Sources: MSYS2, MSYS2 environments, MSYS2 updating guide, and mingw-w64 MSYS2 instructions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.