Install MSYS2 on Windows

MinGW brings GNU compiler tools to Windows since the late 1990s. MSYS2 provides numerous developer tools including MinGW on Windows using pacman package manager.


  1. Download msys2-x86_64-*.exe and run the installer, installing to C:/msys64. MSYS2 needs to be on a non-FAT / non-ExFAT drive capable of symbolic links, such as C:.

  2. Start the MSYS2 console in the Windows Start menu. Update MSYS2 to get the latest packages in the MSYS2 terminal. Run this command multiple times until it says “nothing to do”.

    pacman -Syuu
  3. add to your Windows user PATH:


PowerShell (optional)

To use MSYS2 / MinGW64 programs from PowerShell without disrupting other compiler use, we create ~/gcc.ps1 containing:

$Env:path += ";c:/msys64/mingw64/bin/"

When it’s desired to use MSYS from a PowerShell prompt run ~/gcc.ps1.


From MSYS2 command prompt, tasks include:

Search for packages:

pacman -Ss gcc


MSYS2 packages of interest for scientific computing include:



build systems


If you have confusion about why another version of a program is being used, check executable location like:

where gcc

You may need to reorder directories in your Windows Path variable, for example GNU Octave may need to be moved lower in the Path list or removed from Path.



The advantages of MSYS2 over complementary approaches include:

  • Cygwin:
    • MSYS2 works from the Windows Command Prompt or PowerShell
    • MSYS2 provides native Window binaries
    • Cygwin does not have a command-line package installer
  • Windows Subsystem for Linux: same as Cygwin
  • Chocolatey provides many general Windows programs of interest to end users. MSYS2 is available via Chocolatey:
    choco install msys2
  • Scoop is similar to Chocolatey, but more developer oriented. MSYS2 is available via Scoop:
    scoop install msys2
  • AppGet is similar to Chocolatey, with a smaller set of packages
  • WinGet is from Microsoft and is also like Chocolatey and design inspired by AppGet
  • standalone MinGW generally is not up to date, has an old GCC version and no way to install packages