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. You should avoid installing into any directory or subdirectory having names like "Program Files" or "My Documents", etc.
No version numbering convention exists for MinGW as a whole. Each package has its own version number, and the installer version number does not correlate, in any way, with the version number of any individual package which it installs.
The preferred installation target directory is C:\MinGW
The preferred installation method is using the automated installer tool. While a manual installation is possible, we do not reccommend it. Instructions are provided below if you really want to risk it.
After installation you will need to perform some additional tasks yourself to ensure your MinGW applications will run. Most importantly, you will need to make changes to your PATH environment variable. Be careful: there are two PATH variables which can be changed, and changing the wrong one can have significant consequences. Instructions for changing the correct PATH variable are provided below.
You will also need to ensure you specify the correct installation target directory to the MinGW environment. While it is possible to install MinGW to a location other than C:\MinGW (ie on a different drive), you must ensure that the MinGW environment knows where it is located. Instructions for doing this are also provided below.
Graphical User Interface Installer
An automated GUI first time installer tool called mingw-get-inst is currently the preferred method of installation.
The mingw-get-inst tool will only facilitate the initial set up of the CLI (Command Line Interface) mingw-get installer. Note that the mingw-get-inst tool is not an official GUI installer; it is intended for first time use only, to set up the CLI installer which should be used for all subsequent updates or modifications.
An official GUI installer is currently under development, but remains temporarily unpublished. For those willing to assist with the evaluation and testing of the GUI installer development snapshots, these will be made available from the developer's personal SourceForge project pages, (see below).
To use the mingw-get-inst automated first time installer tool, do the following:
- Click on this mingw-get-inst [6] link to take you to the installation tool server directory.
- Click on the directory that has the most recent date string (yyyymmdd) in its name.
- Locate the file named "mingw-get-inst" ending in ".exe", and having the most recent date string (yyyymmdd) in its name.
- Click on that link and save the file to your local hard drive.
- Locate the file you have downloaded, and double click on it to start the installer.
- Locate the directory into which you want to install MinGW (ie C:\MinGW). Use the advice given above: that the absolute path to this directory should not contain any spaces.
- Select the option to update package catalogues to latest available. NOTE: If you attempt to use the bundled catalogues, you may install a hopelessly out-of-date system.
- Select the optional components to be installed, including the C++, Fortran, Objective-C, and Ada compilers and MSYS.
- The set up tool will download and run the mingw-get CLI installer, to install the selected component packages. NOTE: The make and GDB packages are installed automatically by the set up tool.
NOTE: The preferred installation is to always include the MSYS addon, regardless of other packages you also choose.
NOTE: In many cases, you will probably need to add the C++ compiler as well
(The MinGW release notes contain more detailed information about the configuration and use of the mingw-get-inst set up tool).
After Installing You Should
If you used the automated installation tool and installed MSYS [7] as an addon to MinGW, you do not need to change your PATH environment variable.
If you used either of the GUI installers (the mingw-get-inst [8] tool or the unofficial installer snapshot), and you installed the MSYS [7] add on, they will create a start menu "MinGW Shell" shortcut in your "Start \ Programs \ MinGW" folder. Double clicking the shortcut will open a command window with the correct environment setup for you, including the correct path references, allowing you to run any of the MinGW or MSYS applications within that command window.
Regardless of how you installed MinGW or MSYS, you should check your MSYS configuration (if you have installed MSYS). You need to ensure that MSYS knows where it is located:
- Open a Windows Explorer window and locate your installation directory (ie C:\MinGW)
- Below your installation directory, you should find a directory named "msys" in lower case letters.
- Find (and open) the additional subdirectories "1.0" and "etc".
- Within the "etc" directory, there is a file named "fstab". Open it with a text editor. You should be able to do this by right clicking on it, and in the popup menu select "Open" or "Open With"
- Edit the file and ensure that it reads as follows:
<installation-directory> /mingwNOTE: Substitute <installation-directory> with the FULL and absolute path to where you installed MinGW (ie C:\MinGW). Make sure you follow the <installation-directory> entry with at least one space before typing the "/mingw" entry.
NOTE: Before you save the file, make sure there is at least one blank line at the bottom below all of the entries that may exist, then save and close the file.
Your MinGW and MSYS installations should now be ready for use.
Caveats: (exceptions)
If you ever intend to run MinGW or its applications using a cmd.exe window, you will need to make changes to your PATH environment variable. Instructions for doing so are listed in the Environment Settings section below.
Updating or Changing Your MinGW or MSYS Installation
There are two options for updating, adding, or removing components from your installation:
- Using GUI Installer Development Snapshots
- Using the CLI (Command Line Interface) Installer
Both methods will allow you to modify the original installation packages, in addition to the following available addon packages:
- C++ (actually g++)
- fortran (Fortran 90/95 compiler)
- ada (Ada compiler)
- java (Java compiler)
- objc (Objective-C compiler)
- mingw32-make (GNU make)
- gdb (GNU debugger)
- msys-base (MSYS shell environment)
Using GUI Installer Development Snapshots
After you have completed the first time set up (described above) you are expected to use the CLI Installer (described below) to manage and update your MinGW installation.
If you are uncomfortable with using the CLI, you may wish to consider running a development snapshot of the GUI Installer. You can also participate in the development and testing of the GUI version of the installer. Even if your participation is limited to offering suggestions based on your user experience, your input will be greatly appreciated.
Currently, development snapshots are made available here [9], on an ad-hoc basis. To install any (ideally the latest) of these snapshots:
- First ensure that you have completed a basic mingw-get installation, (e.g. using the set up tool, as described above).
- Locate the preferred snapshot archive; (it will be identified by an "-hg-YYYYMMDD-N.bxz.zip" suffix) and download it.
- Unzip this archive into the same MinGW installation directory as you chose when you ran the set up tool; (formally, this is the parent of the "bin" subdirectory in which mingw-get.exe is installed, if you used any other installation method).
- For a first-time snapshot installation, from a command prompt, (cmd.exe or MSYS shell), run the installation command:
mingw-get install --start-menu mingw-get-gui - To upgrade to subsequent snapshots, repeat the manual download and unzip steps, for the new snapshot archive, then run the upgrade command:
mingw-get upgrade --start-menu mingw-get-gui - After completing these steps, you may invoke the GUI Installer from the shortcut in your start menu, or directly from the command line, by invoking:
mingw-getwithout specifying any argument.
Using the Command Line Interface Installer
The tool used for command line installation is called mingw-get. Note that it differs from mingw-get-inst. Although currently designated as a 'beta' release, mingw-get is capable of installing GCC 4.x and the basic (optional) MSYS shell environment recommended to support it.
Since it is still under development, we ask that you manually perform some follow-up actions, which you might rightfully expect the installer to complete for you; eventually it will, but in the meantime, please bear with us).
Download the latest version of the mingw-get [10] installer and extract the files to the C:\MinGW directory using a program that can extract zip files. Recent versions of Windows may support this directly from the Windows Explorer; alternatively you may use a freeware program such as 7-Zip [11].
After extracting the files, you will need to make changes to your user PATH environment variable. See the instructions in the section "Environment Settings" below now.
You should also read the section "After Installation You Should" above.
After changing your user PATH, you will need to open a new Command Prompt window. Click on "Start \ Run" and enter "cmd" then click "OK".
At the Command Prompt, type the command:
mingw-get install gccto download and install the C compiler, and its requisite support packages; (mingwrt, w32api and binutils, for those interested).For example, the command:
mingw-get install gcc g++ mingw32-makewill install the C compiler, C++ compiler, and make utility.You can install more additional packages at any time. For example, the command:
mingw-get install fortran gdbwill add the Fortran 90/95 compiler and debugger to the existing installation.
If you choose to also install 'msys-base', note that its default installation path is now 'C:\MinGW\MSYS\1.0'. The easiest way to start the shell is by running the msys.bat file found in that directory.
The first time you start the shell, you may also wish to run the command:
/postinstall/pi.shThis is only a temporary measure to establish bindings between your MinGW and MSYS installations. The command will become unnecessary, when appropriate post-install scripting is added to the MSYS package catalogues.
The mingw-get release notes contain more detailed information about the configuration and use of the mingw-get installer. GCC documentation [12], make documentation [13], and GDB documentation [14] are available online.
Cautions
- The installers do not automatically modify any environment settings, (in particular the PATH). You will need to add the MinGW [15] `bin' directory, as described in the "Environment Settings" section below.
- Administrative note The MinGW team do not recommend modifying the Windows PATH variable system wide. We prefer that you use a script to set PATH for the processes on a per session basis. This is the reason that we do not adjust the PATH.
- For versions of MSYS [7] prior to MSYS-1.0.11; do not install MinGW into the same path as MSYS; (you may install to a subdirectory of the MSYS tree, as long as non-MSYS executables are not placed in the MSYS /bin directory). You probably don't have to worry about this.
- When you install both MSYS [7] and MinGW [15], and have /mingw mapped to your MinGW directory (as is the default), if you then install ports, supplementary MinGW programs or dependency libraries, you are advised to install them into the /mingw directory tree, to ensure that they will be available for use with GCC [16]; e.g. you should configure with
../path/to/configure --prefix=/mingw
or
../path/to/configure --prefix=`cd /mingw; pwd -W`
(This latter form is preferred, when the program being installed is a native Windows binary, and the prefix may be hard coded into the executable).
Environment Settings
When you install command line tools, such as MinGW [15], or GnuWin32 tools, you have to tell the command line interpreter where to find them. This is usually accomplished by adding the appropriate directory names to the PATH variable in your user environment. The installers will not do this for you.
NOTE If you choose to alter your PATH variable, you must ensure you alter your user PATH variable, not your system PATH variable -- there are two of them!
NOTE The MinGW team do not recommend modifying the system wide Windows PATH variable. We prefer that you use a script to set PATH for the processes on a per session basis. See the notes in the "After Installation You Should" section above.
Warning: Adding entries to the PATH is normally harmless. However, if you delete any existing entries, you may mess up your PATH string, and you could seriously compromise the functioning of your computer. Please be careful. Proceed at your own risk.
- Right-click on your "My Computer" icon and select "Properties".
- Click on the "Advanced" tab, then on the "Environment Variables" button.
- You should be presented with a dialog box with two text boxes. The top box shows your user settings. The PATH entry in this box is the one you want to modify. Note that the bottom text box allows you to change the system PATH variable. You should not alter the system path variable in any manner, or you will cause all sorts of problems for you and your computer!
- Click on the PATH entry in the TOP box, then click on the "Edit" button
- Scroll to the end of the string and at the end add
;<installation-directory>\bin - press OK -> OK -> OK and you are done.
NOTE: Substitute <installation-directory> with the FULL absolute path name of the installation target directory you chose (ie C:\MinGW);
NOTE: If you installed MSYS, you may also want to add ";<installation-directory>\MSYS\1.0\local\bin", and ";<installation-directory>\MSYS\1.0\bin" to the end of your user PATH variable.
More Information
More information on Configuring and Using mingw-get [19] is available.
Manual Installation
Manual installation, as an alternative to the use of the automated installer described above, is not recommended; nevertheless it is possible. If you wish to pursue this option, you may install MinGW by manually downloading and extracting individual components. Please refer to HOWTO Install the MinGW (GCC) Compiler Suite [20] for (possibly outdated) information on manual installation.