-
Notifications
You must be signed in to change notification settings - Fork 11
Set up Windows dev environment with MSYS2
Note: $VARS refer to strings you should substitute yourself. E.g. $DEV -> D:/dev
- Download from
http://msys2.github.io - Install into
$DEV/msys64 - Run
$DEV/msys2_shell.bat - Run
update-core - Close the shell; reopen it
- Run
pacman -Su
pacman is the package manager bundled with msys. Use it to install useful things
like gcc, flex, bison, git. The commands are pretty cryptic, so use the
Pacman/Rosetta.
- Open "Environment Variables > System Variables > Path"
- At the end, add
$DEV/msys64/usr/bin
By default, msys will use $DEV/msys64/home as your home folder.
If you want to use your existing home folder, set a $HOME env variable:
- Under "Environment Variables > User variables", add
HOME-> (path to your home folder)
(Using C:\Users\%USERNAME% didn't work for me.)
Also, SSH insists on using MSYS' /home, but you can get around that by adding this line to /etc/fstab:
C:/Users /home ntfs binary,noacl,auto 1 1
- Open an msys shell
- Run
pacman -S git - If you want to use
git gui/gitk,- Run
pacman -S mingw-w64-x86_64-tk - Add
$DEV/msys64/mingw64/binto$PATH -
gitkshould work now, but you might get this problem withgit gui - To fix, add env var
GIT_GUI_LIB_DIR->$DEV/msys64/usr/share/git-gui/lib
- Run
$DEV/msys64/*_shell.bat open up $DEV/msys64/usr/bin/mintty.exe, which has problems
with the Python installed by the official Python installers. If you prefer, you can use
$DEV/msys64/usr/bin/bash.exe by making a shortcut to it (on your desktop, for example).
To customize:
- (right-click shortcut) > Properties
- Change "Shortcut > Start in:" to be the directory you want it to open to, e.g.
%HOME%/Desktop - Fiddle with settings in Options, Font, Layout, and Colors
Environment variables in windows are under:
- (right-click start) > System > Advanced System Settings > Advanced > Environment Variables...
You can also set env vars in your .bash_profile/.bashrc.
git-bash has a special --cd option to set the directory on startup, which regular bash doesn't. To get around that, create $DEV/bash.bat:
@echo off
if not "z%1" == "z" cd "%1"
"$DEV/msys64/usr/bin/bash.exe"Next, create a regedit file (*.reg):
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell\bash]
@="Bash"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
"Position"="Bottom"
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell\bash\command]
@="d:\\dev\\bash.bat"
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\bash]
@="Bash"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
"Position"="Bottom"
[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\bash\command]
@="d:\\dev\\bash.bat \"%1\""
Note the paths have to be Windows-style, with escaped (double) backslashes, and that the "Background" entry's command should not contain %1. Feel free to change the "Icon" and "Position" properties. Execute the regedit file and you're done.