How does MSYS2 differ from Cygwin
Cygwin and MSYS2 -- as projects -- have significantly different goals.
Cygwin tries to bring a POSIX-compatible environment to Windows so that most software that runs on unices will build and run on Cygwin without any significant modifications. Cygwin provides a large collection of packages containing such software, and libraries for their development.
MSYS2 tries to provide an environment for building native Windows software. MSYS2 provides a large collection of packages containing such software, and libraries for their development. As a large portion of the software uses GNU build tools which are tightly coupled to the unix world, this environment is also POSIX-compatible, and is in fact based on Cygwin.
MSYS2 provides a minimal shell required to run autotools and other build systems which get the source for software from the Internet from different repositories, configure them and build them. The shell and core tools exist mainly to allow porting Unix programs to run natively on Windows (i.e. without requiring a POSIX emulation layer). MSYS2 doesn't try to duplicate Cygwin's efforts more than necessary, so the number of provided POSIX-emulated software is very small.
MSYS2 uses Pacman (of Arch Linux) to manage its packages and comes with three different package repositories:
msys2: Containing MSYS2-dependent software
mingw64: Containing 64-bit native Windows software (compiled with mingw-w64 x86_64 toolchain)
mingw32: Containing 32-bit native Windows software (compiled with mingw-w64 i686 toolchain)
Cygwin comes only with Cygwin-dependent software. It uses its own package management system, commonly called setup.exe.
Cygwin provides a runtime library called
cygwin1.dll that provides the POSIX compatibility layer where necessary. The MSYS2 variant of this library is called
msys-2.0.dll and includes the following changes to support using native Windows programs:
- Automatic path mangling of command line arguments and environment variables to Windows form on the fly. (This can be selectively turned off.)
- Ability to change the reported OS using an environment variable (
MSYSTEM, with values of
MINGW64). This allows mingw-w64 software to be built in native build mode (as opposed to cross-compilation mode).
- Conversion of output of native Windown applications from Windows line endings to POSIX line endings by removing trailing
'\r'characters, so that e.g.
bb=$(gcc --print-search-dirs)works as expected.
- Replacement of symlinks with copying, so that Windows programs don't trip up on these files. MSYS2 also supports creating native NTFS symlinks, but these are limited in other ways.
- Removal of the
/cygdriveprefix for automounts. This is to retain compatibility with MSYS-enabled software that makes assumptions about
/c/being equivalent to
C:/, and it saves a bit of typing.
- Switch to
noaclon default mounts. This prevents any permission mangling from MSYS2.
- MSYS2 releases might be ahead of or behind Cygwin releases.
Other notable differences:
- System root is
- Removal of system integration stuff, such as
- Dynamic libraries are prefixed
cyg(most other platforms, including mingw-w64, use
- Addition of the "-W" option to the
pwdcommand in shells for compatibility with the old MSYS.
- Various changes in utilities to help retain compatibility and interoperability. An example is Perl reporting
$^O, or Sed recognizing CRLF as a line ending.