Minimalist GNU for Windows
Note: These instructions down downloading and installing MinGW are no longer being updated regularly. For up-to-date instructions, please refer to the instructions for Getting Started on the new MinGWiki.
Using the (possibly "Proposed"/"Candidate") Installer
If you are new to MinGW, the recommended way to begin is to download an installer executable from http://www.mingw.org/download.shtml and run it (e.g. MinGW-5.0.2.exe -- currently there is only a 'Proposed' Version). This package will install mingw-runtime, w32api, GCC, binutils and mingw32-make but it may not be the latest versions of the individual packages. Once you have all these packages (although mingw32-make is not necessary if you have MSYS or Cygwin), you may download updated individual packages like GCC and extract them into the MinGW directory.
Warning: For versions prior to MSYS-1.0.11; do not install MinGW into the same path as MSYS (but it can be a subdirectory as long as non-MSYS executables are not in the MSYS bin directory)
Warning2: When you install msys and mingw, and have /mingw mapped to your mingw directory (as is the default), if you install ports or install any programs, they must install to /mingw to be available for gcc to use (i.e. ./configure --prefix=/mingw).
Manually (non one-click method)
Instead of using an installer you can as well get all required packets and unpack them manually into a subdirectory. In fact that's what this writer is doing himself.
- Download at least the following (or newer) packages from the MinGW download page (the automated mingw installer I think includes all of these and sets up the right directory for you--what it's doing is downloading compilers and default header files, and putting them in one place on your system, so the future builds will use those compilers and directories for building)
You may want to add any of the following additional languages
- These files are gzipped tarballs, Linux users will probably be familiar with .tar.gz files, but they are not that common under Windows. Essentially they are compressed folders like zip files. In order to access the contents you will need to decompress them, this requires that you have gzip and tar installed on your machine. Linux comes with these as standard in every distribution, but under Windows you will need to install them manually. Windows versions can be found at: http://gnuwin32.sourceforge.net/packages/gzip.htm and http://gnuwin32.sourceforge.net/packages/tar.htm. Download the setup files and install the applications. Before you use them you need to tell Windows where to find them; specifically this means adding the install directory to your PATH. To do this carry out the following procedure (Warning - adding entries to the path is totally benign, however if you delete you messup your path string then you could seriously compromise the functioning of your computer, please be careful)
- Right-click on "My Computer" and select "Properties".
- Click Advanced -> Environment Variables.
- In the box entitled "System Variables" scroll down to the line that says "Path" and double-click the entry.
- You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the Path variable. It is very important that you do not delete the existsing values in the path string, this will cause all sorts of problems for you! Scroll to the end of the string and at the end add ";<installation-directory>\bin", press OK -> OK -> OK and you are done. Here <installation-directory> is the full address of the installation directory; if you accepted the defaults when installing tar and gzip then it will (proably) be "C:\Program Files\GnuWin32". Don't forget the semicolon, this separates the entries in the path.
Create a directory to install all the stuff into. This writer usually creates c:\MinGW and copies all of the above files in there. Now issue the following commands:
cd /d c:\MinGW
gzip -df binutils-2.16.91-20060119-1.tar.gz
tar -xf binutils-2.16.91-20060119-1.tar
ren dir dir.binutils
gzip -df gcc-core-3.4.5-20060117-1.tar.gz
tar -xf gcc-core-3.4.5-20060117-1.tar
copy dir dir.gcc
gzip -df gcc-g++-3.4.5-20060117-1.tar.gz
tar -xf gcc-g++-3.4.5-20060117-1.tar
gzip -df mingw-runtime-3.9.tar.gz
tar -xf mingw-runtime-3.9.tar
ren dir dir.gcc
gzip -df w32api-3.6.tar.gz
tar -xf w32api-3.6.tar
- The commands copying and concatenating the info-dir files are really a rather crude way of creating a combined dir file and could use some enhancement
To add additional languages apply some or all of the follwoing commands:
cd /d c:\MinGW
tar xvzf gcc-ada-3.4.5-20060117-1.tar.gz
tar xvzf gcc-g77-3.4.5-20060117-1.tar.gz
tar xvzf gcc-java-3.4.5-20060117-1.tar.gz
tar xvzf gcc-objc-3.4.5-20060117-1.tar.gz
- Last but not least you probably will want to install MSYS as well (details are hopefully described elsewhere)
See also: GettingStarted