First, install MinGW.
Then, start the MSYS Installer as for any other Windows program.
Choose the default option whenever you asked to.
In the post-install session (a DOS prompt), you will be asked if MinGW is installed.
Type 'y' on all questions.
To run a MSYS shell, just click the MSYS desktop icon (created by default).
To run MSYS there is really no configuration needed.
MSYS is installed by default in the folder C:\MSYS\1.0, and binaries will be found in C:\MSYS\1.0\bin.
There is no need to add this path to the PATH Environment variable.
Let's assume you are logged in on Windows as user me:
Just like in a UNIX shell session, the default directory is your home directory.
Using make and gcc
Check out the paths to the tools:
$ which gcc
MSYS uses its own make by default:
$ which make
If you want to use MinGW's make instead, you have to use its special name:
$ which mingw32-make
Directory mapping and mount points
MSYS uses the following automatic mounts (that is, not configurable) in its directory layout:
Read all the details about how automatic points works in /doc/msys/README.rtf (that is, C:\msys\1.0\doc\msys\README.rtf outside MSYS), included in the MSYS distribution.
How to configure mount points manually
If we access C:\MSYS\1.0\mingw outside MSYS, we that this directory is (and should be) empty.
But when accessing /mingw in a MSYS shell, we see the following (assuming MinGW was installed before MSYS):
$ ls /mingw
COPYING MinGW-5.1.3.exe bin include installed.ini libexec mingw32
COPYING.LIB MinGW.url doc info lib man uninst.exe
This is because it is configured (automatically, during the MSYS installation) in /etc/fstab (that is, C:\msys\1.0\etc\fstab outside MSYS) as a user defined file system binding.
As the file name /etc/fstab indicates, this can be seen as a mount point.
(Or, if you prefer, as creating a "directory symlink".)
If you want to access other directories without using the full path, you can configure your own mount points.
Assume we have some source code in c:/Documents and Settings/Administrator/src that we want to access easily from within MSYS, without using the full path every time.
Create an empty directory C:\msys\1.0\home\me\src outside MSYS, or /home/me/src inside MSYS:
$ mkdir /home/me/src
Edit C:\msys\1.0\etc\fstab (use for example WordPad outside MSYS, or vi inside MSYS):
# Mount point created automatically during install
# Create a mount point for c:/Documents and Settings/Administrator/src on /home/me/src
If you have any problems with configuring similar to the ones I experienced, read these notes:
# Different from UNIX, in MS Windows both source and destination directories have to exist.
# Source directory (c:/Documents and Settings/Administrator/src) will contain the files,
# destination directory (/home/me/src) must exist and be empty.
# /home/me/ is already mapped to c:/msys/1.0/home/me
# That means that C:\msys\1.0\home\me\src has to be created manually.
# This can be done either with Windows Explorer, or with the "mkdir src" command
# in a MSYS shell (in the /home/me directory).
# NOTE 2:
# When I just finished installing MSYS, I had problems to reflect changes in this file,
# even when closing a MSYS session and opening a new one.
# The solution was to restart Windows.
# Anyhow, this seems to be a one-time problem.
# From there and on, restart Windows is no longer needed, just close the MSYS session and open a new one.
# NOTE 3:
# I had problems using long names (with spaces) in path names.
# c:/Documents and Settings/Administrator/src /home/me/src #DOES NOT WORK!
# c:/Documents\ and\ Settings/Administrator/src /home/me/src #DOES NOT WORK!
# c:/DOCUME~1/ADMINI~1/src /home/me/src #WORKS!
# The solution was to find out the short name for the path.
# To do this, open a DOS prompt and type "dir /-N".
Using third-party programs through wrapper scripts
There is no way to create a "file symlink" in MSYS in a way similar to a "directory symlink" (that is, a mount point).
The command ln for creating links works, but it actually makes a copy of the original file, not a symlink to it.
This is not what we want.
The solution is to create a wrapper script in /usr/local/bin.
The PATH environment variable in MSYS reflects the one configured in Window's Control Panel, with the MSYS and MinGW paths prepended:
As we see, first the current directory is searched, then /usr/local/bin/, then the MinGW path (/mingw/bin), then the MSYS path (/bin).
You can take advantage of the path /usr/local/bin being prepended to $PATH, to create your own shell script wrappers.
This way, you can call any Windows program without using the full path.
Create the /usr/local/bin directory if it doesn't exist:
mkdir -p /usr/local/bin
Create /usr/local/bin/wp, a wrapper for WordPad.exe:
Now you can edit any file from inside MSYS either with the command
depending on your preferencies.
More info about mount points and scripts can be found in C:\msys\1.0\doc\msys\README.rtf, included in the MSYS distribution.
"If you wish to map a path with spaces you must use the DOS style name."
This also holds true for paths with spaces (a.k.a. 8dot3 file names) in script variables.
While the script /usr/local/bin/wp in Example 1 above works, the following script /usr/local/bin/wp_8dot3 will NOT work:
#!/bin/sh# NON-WORKING SCRIPT!
# Running this script will fail with the following error:
# /usr/local/bin/wp_8dot3: /c/Program\: No such file or directory
WP_EXE="/c/Program\ Files/Windows\ NT/Accessories/wordpad.exe"
Here is how to find the path manually:
#!/bin/sh# CD C:\
# DIR /X|FINDSTR PROG
# 19/11/2007 10:16 <DIR> PROGRA~1 Program Files
# CD "Program Files"
# DIR /X|FINDSTR WIN
# 04/04/2005 19:06 <DIR> WINDOW~4 Windows Journal Viewer
# 22/02/2006 21:45 <DIR> WINDOW~2 Windows Media Player
# 04/04/2005 18:40 <DIR> WINDOW~1 Windows NT
# CD "Windows NT"
# DIR /X|FINDSTR ACC
# 04/04/2005 19:08 <DIR> ACCESS~1 Accessories
# CD Accessories
# DIR /X|FINDSTR wordpad
# 04/08/2004 06:00 214.528 wordpad.exe
Finding the path manually may be a bit tedious.
You can download the script non8dot3, which converts 8dot3 paths to non-8dot3 ones.
As mentioned before, MSYS requires MinGW to be installed.
If you want other development tools than make, you should consider installing msysDTK, which basically includes autoconf, automake, libtool, autogen, openssl, openssh, cvs, guile, and inetutils.
You may also install GDB for MinGW.