Minimalist GNU for Windows
How to start a MSYS shell
There are a couple of methods to start a MSYS shell :
- If the msysDVLPR package installed, start the MinGW shell (msys.bat) by typing 'msysdvlpr' to start a new shell. If you don't have the file 'msysdvlpr', you should type 'start /msys.bat MSYS'
- If the MSYS package is installed, from Windows' Start | Programs | MinGW | MSYS | msys starts the MSYS shell.
- If the "msys.bat" file is in your system path; then you can run "msys.bat MSYS". You can also use a DOS command box to go to the directory where msys.bat is, and then type "msys.bat"
If you don't don't want to inherit the windows PATH environment, you can create a script (such as 'tomsys') in your /bin directory :
To not inherit the $PATH:
#! /bin/sh export MSYSTEM=MSYS export PATH= /bin/sh --login -i
To inherit the $PATH:
#! /bin/sh export MSYSTEM=MSYS export PATH=.:/usr/local/bin:/bin:/mingw/bin:$PATH /bin/sh --login -i
You can then freely switch to MSYS by typing "tomys" (or your script name), and go back to MinGW by typing "exit". You can also switch "/bin/sh --login -i" by another shell. You can then have several scripts (tobash2.05, tobash3.0, etc...)
How do I check if we are in a MSYS shell?
- Either by typing "uname -s": you should get a line such as "MSYS_xxx" (ie. MSYS_NT-5.1)
- The title bar of your window, by default, has the name "MSYS_xxx" in it.
How to start a MSYS shell on Windows XP Professional x64
On Windows XP Professional x64, msys.bat opens a window that quickly closes. Looking more closely, rxvt dies with the following error.
C:\msys\1.0\bin\rxvt.exe: *** fork: can't reserve memory for stack 0x480000 - 0x680000, Win32 error 0
0 [main] rxvt 2928 sync_with_child: child 1440(0x2CC) died before initialization with status code 0x1
43 [main] rxvt 2928 sync_with_child: *** child state waiting for longjmp
rxvt: can't fork
rxvt: aborting
The problem is easily circumvented by running msys.bat in a 32-bit command prompt. This can be achieved with the following batch file. Let's just call it my_msys.bat. You should put it in c:\msys\1.0. Now all you have to do is to change the MSYS shortcut in Start Menu\MinGW\MSYS to point to it.
@echo off if "%PROCESSOR_ARCHITECTURE%" == "AMD64" SET COMSPEC=%WINDIR%\SysWOW64\cmd.exe ..\msys.bat
Or better yet, patch MSYS.bat with the diff in
http://sourceforge.net/tracker/index.php?func=detail&aid=1351029&group_id=2435&atid=302435
How do I start the MSYS shell in the recommended W32 Console?
The Win32 console may be started by launching MSYS with C:\msys\1.0\msys.bat --norxvt.
If the --rxvt option does not work, a newer version of msys.bat may be needed.
- The one from MSYS-1.0.11 works, but the one from earlier releases may not.
- It is possible to get the latest version from
CVS. - Or, rename MSYS' /bin/rxvt.exe to /bin/rxvt.exe.not to reversibly disable it.
Why would I want to use the recommended W32 Console instead of RXVT?
- The default RXVT console is flaky and not recommended.
- The default should change from RXVT to the W32 Console when MSYS-1.0.11 is released.
- The natural ugliness of the W32 console can be dealt with by reading
this mailing list posting, which describes how to make it more presentable.
Usage and Configuration
How do I copy and paste text, in an MSYS console?
With the native Win32 console
- Clicking the C:\ icon in the upper left corner reveals an edit menu that contains options for mouse-driven copy/paste.
This mailing list
posting indicates how to set it up so that a left-button drag highlights, a right-button click completes the copy, and then further right-button clicks paste; this allows copy and paste without any messing about in the Win32 console menus.If the mailing list instructions to not work, this Microsoft Knowledgebase
article has instructions that should work. Be sure to follow the instructions using an MSYS Shell as the customization is unique to windows with a particular title.
- If using RXVT, use a left-button drag of the mouse to highlight the text to be copied, release the mouse button to complete the copy, then click the middle-button to paste at the input cursor.
- See Also: Clipboard Copy And Paste
How do I change the colors of the MSYS console?
- See this mailing list
article for details on setting the W32 console. For RXVT, edit \msys\1.0\msys.bat and change the following lines as desired. :
:startrxvt ... if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=LightYellow? if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=NavySome colors to choose from: Red Yellow Black White Brown Green Navy Magenta Cyan LightYellow
The default rxvt font size is too small. How do I enlarge it?
Open C:\MSYS\1.0\msys.bat with a text editor and search for a line containing "80x25". Then replace it with:
start rxvt -backspacekey ^H -sl 2500 -fg grey90 -bg black -sr -fn "Courier-bold-20" -tn msys -geometry 80x25 -e /bin/sh --login -iYou can change the Courier font above with your favorite one. Note that using TrueType fonts (such as Courier New or Lucida Console) will result in sluggish performance under Windows XP.
Why don't the Home and End keys work in rxvt and vim?
This is because rxvt's terminal emulation uses different escape codes for these two keys. You will find some discussion on this in
this mailing list thread, with specific advice offered in
this message and
this follow-up.
The following sample ~/.inputrc file offers one possible solution for this issue; you may wish to adapt it, based on the advice offered in the above discussion thread:--
set completion-query-items 100 set completion-ignore-case on set show-all-if-ambiguous off set input-meta on set output-meta on set convert-meta off set bell-style none "\e[2~": paste-from-clipboard "\e[3~": delete-char "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[7~": beginning-of-line "\e[8~": end-of-lineAlso, you need to set up your ~/.vimrc to enable the Home/End keys in ViM:
set nocompatible set backspace=2 syntax on map <Esc>[7~ <Home> map <Esc>[8~ <End> imap <Esc>[7~ <Home> imap <Esc>[8~ <End>
How do I set up a profile for the MSYS Shell?
- After installation, set up your .profile something like this.
Create a .profile file in your home directory
Put the content needed into it. An example might be:
#!/bin/sh.exe # # Get the aliases and functions # if [ -f ${HOME}/.bashrc ] then . ${HOME}/.bashrc fi export CVS_RSH="ssh" export EDITOR="/usr/bin/vim" export HISTSIZE="500" export PATH="${HOME}/bin:${PATH}"Create a .bashrc file in your home directory :
Put the content needed into it. An example might be:
# .bashrc # Source global definitions if [ -f /etc/bashrc ] then . /etc/bashrc fi # User specific aliases and functions #
- Close and restart the MSYS Shell.


