Install MSYS2 on Windows

MinGW has been bringing GNU compiler tools to Windows since the late 1990s. MSYS2 provides a superset of tools including MinGW, with more complete and up to date GNU compiler set, using pacman package manager.


  1. download msys2-x86_64-*.exe
  2. run the installer, installing to c:/msys64. It needs to be on a non-FAT/ExFAT drive, such as c:.
  3. To run, start the MSYS2 console in the Windows Start menu, which sets up all the needed paths, just for that terminal session.
  4. do an update to get the latest packages, in the MSYS2 terminal. Run this command multiple times until it says “nothing to do”.

    pacman -Syuu

To use MSYS2 / MinGW64 programs from regular command prompts, add MinGW64 to Windows PATH, typically C:/msys64/mingw64/bin


From MSYS2 command prompt, tasks include:

Search for packages:

pacman -Ss gcc

Install MinGW packages

  • gcc: pacman -S mingw64/mingw-w64-x86_64-gcc
  • gfortran: pacman -S mingw64/mingw-w64-x86_64-gcc-fortran
  • HDF5: pacman -S mingw64/mingw-w64-x86_64-hdf5
  • ninja: pacman -S mingw64/mingw-w64-x86_64-ninja
  • make: pacman -S mingw64/mingw-w64-x86_64-make
  • pkg-config: pacman -S mingw64/mingw-w64-x86_64-pkg-config
  • aspell: pacman -S mingw64/mingw-w64-x86_64-aspell mingw64/mingw-w64-x86_64-aspell-en

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.

When packages are installed in MinGW64, you must run from from MSYS2 MinGW64 terminal, or have added MSYS2 MinGW64 to your Command Prompt Path (in step 5 above).