This page will guide you through a typical, one size fits all, installation of MinGW. If you are new to MinGW, you may wish to refer to the MinGW page to learn which packages are required, and which tools are used to perform which tasks. For more advanced installation instructions, refer to HOWTO Install the MinGW (GCC) Compiler Suite.
MinGW Installation Notes
MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any location with spaces in the path name reference; i.e. you should avoid installing into any subdirectory of "Program Files" or "My Documents", or the like.
No version numbering convention exists, for MinGW as a whole. Each package has its own version number, and the installer version number does not necessarily reflect the version number of any individual package which it installs.
Note: The automated installer is now considered deprecated, and is currently unmaintained; it will not install GCC 4. You will get GCC 3 using this method. If you want to install the latest GCC release, use the Manual Installation method below.
Download the latest MinGW-5.x.x.exe installer from sourceforge.net and run it. When prompted to choose which package you wish, if unsure or if you have never used MinGW before, we recommend choosing the "current" package (the default option). You will then be able to choose which components you wish to install:
- MinGW base tools: This required component is composed of binutils, the C compiler, the runtime libraries and platform API.
- ... compiler: These components each install a compiler for the programming language specified in the label of the component. Usually, you will at least want to also install the C++ compiler.
- MinGW make: This component installs make, a program capable of interpreting Makefiles. This component is highly recommended for those who don't want to also install MSYS (why not?); many IDE's require this functionality.
When choosing the "Destination Folder" for the installation, please do not choose any path that contains spaces in its absolute name, unless you have read the installation notes above and are willing to accept the possible consequences; if you are in any doubt, accept the default.
The installer will then download and install the components selected.
As an alternative to the automated installer, you may install MinGW by manually downloading and uncompressing individual components.
Before proceeding, you are encouraged to consult the release notes for each individual package; links to these will be found adjacent to each package file entry, on the MinGW Download Page.
Download at least the following (or newer) packages from the MinGW Download Page; where two or more component packages are indicated, you need both / all of them. (Note that the package links provided here refer to current releases at the time of writing; these links may not necessarily be updated immediately, when new releases become available):
- mingw-runtime (dev and dll)
- Required runtime libraries for GCC (gmp, libiconv, MPFR and pthreads)
- gcc-core (bin and dll)
These are the minimum requirements for a working mingw-gcc-toolchain for C.
Optionally you may want to add any of the following additional languages; (for each which you choose to install, you need both the bin and the dll component packages):
- gcc-g++ (bin and dll) for C++
- gcc-objc (bin and dll) for Objective C
- gcc-gfortran (bin and dll) for Fortran 90
- gcc-java (bin and dll) for Java
- gcc-ada (bin and dll) for Ada
Note that the GCC versions of these files must match the GCC version of the gcc-core installed.
Optionally you may want to add any of the following additional utilities:
- mingw-gdb for debugger
- mingw32-make for make
- mingw-utils for MinGW Utilities
- MSYS for Unix-style commands and shell (see the MSYS page for installation instructions)
- msysDTK for Unix-style developer toolkit
You will also need a program that can extract .tar.gz files, (or in some cases .tar.bz2 and .tar.lzma files), such as the GUI-based WinZip (not recommended), or 7-Zip, or the command-line tar, gzip and lzma tools. Command line tools are provided by MSYS (recommended), or Google for 'gnu+tools+win32' to find alternatives. The GnuWin32 project provides Windows-native builds of tar and gzip CLI tools.
Create a directory (e.g. C:\MinGW), download all packages to C:\MinGW, for each package execute gunzip/untar package, and add C:\MinGW\bin; to your PATH environment variable:
C:\Documents and Settings\Owner> cd /d c:\ C:\> md MinGW C:\> cd MinGW
Download all packages to C:\MinGW
C:\MinGW> gzip -d -c binutils-2.20-1-mingw32-bin.tar.gz | tar x C:\MinGW> gzip -d -c mingwrt-3.17-mingw32-dev.tar.gz | tar x C:\MinGW> gzip -d -c mingwrt-3.17-mingw32-dll.tar.gz | tar x C:\MinGW> gzip -d -c w32api-3.14-mingw32-dev.tar.gz | tar x C:\MinGW> gzip -d -c gmp-4.2.4-mingw32-dll.tar.gz | tar x C:\MinGW> lzma -d -c libiconv-1.13.1-1-mingw32-dll-2.tar.lzma | tar x C:\MinGW> gzip -d -c mpfr-2.4.1-mingw32-dll.tar.gz | tar x C:\MinGW> gzip -d -c pthreads-w32-2.8.0-mingw32-dll.tar.gz | tar x C:\MinGW> gzip -d -c gcc-core-4.4.0-mingw32-bin.tar.gz | tar x C:\MinGW> gzip -d -c gcc-core-4.4.0-mingw32-dll.tar.gz | tar x C:\MinGW> set path=C:\MinGW\bin;%path%
The whole C:\MinGW subtree is fully relocatable which means there can be several different versions of the MinGW toolchain installed in parallel, e.g. in directories C:\MinGW-3.4.5 and C:\MinGW-4.4.0. Switching between these is merely a matter of renaming directories, assuming C:\MinGW\bin; has been added to the path. You can permanently add C:\MinGW\bin; to the path by opening the System control panel, going to the Advanced tab, and clicking the Environment Variables button.
Updating single packages (e.g. when there is a new version of the w32api) can be done by copying the new package to C:\MinGW and unpacking as above to overwrite the older version. This manual update also works with an initial automated install.