> For the complete documentation index, see [llms.txt](https://kmanu225.gitbook.io/cs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kmanu225.gitbook.io/cs/software-engineering/unix-linux-on-windows-choosing-the-right-environment/msys2-a-unix-like-development-environment-for-windows.md).

# MSYS2: A Unix-like Development Environment for Windows

[MinGW-w64](/cs/software-engineering/unix-linux-on-windows-choosing-the-right-environment/mingw-w64-gnu-tools-on-windows.md) provides a compiler toolchain. **MSYS2** adds the environment around it: Bash, Unix utilities, package management, build tools, libraries, and several native Windows compiler toolchains.

A simple way to think about it is:

```
MSYS2
   +-- Bash and Unix tools
   +-- pacman package manager
   +-- CMake / Ninja / Make
   +-- GCC or Clang toolchains
          |
          +-- native Windows binaries
```

MSYS2 is therefore a good choice when you want a **Unix-like development workflow while targeting Windows**.

## Which MSYS2 environment should you use?

This is probably the most confusing part of MSYS2 because several terminals are installed. For most users, the choice is simple:

| Environment    | Use it for                                                        |
| -------------- | ----------------------------------------------------------------- |
| **UCRT64**     | **Default choice for modern 64-bit Windows development with GCC** |
| **CLANG64**    | Native 64-bit Windows development with Clang/LLVM                 |
| **CLANGARM64** | Native Windows on ARM development                                 |
| **MSYS**       | Unix-like tools and scripts used by MSYS2 itself                  |
| **MINGW64**    | Legacy GCC environment; avoid for new projects                    |

In short:

```
Want GCC?       -> UCRT64
Want Clang?     -> CLANG64
Windows ARM64?  -> CLANGARM64
MSYS2 internals
or Unix tools?  -> MSYS
```

For new projects, **UCRT64 is usually the safest default**.

## What does a typical workflow look like?

Once the environment is installed, you use its package manager to add the compiler and build tools you need, then work much as you would on Linux:

```bash
cmake -S . -B build -G Ninja
cmake --build build
```

The important point is that the resulting binaries are native Windows executables.

## MSYS2 is not Linux

Despite the Bash prompt and Unix utilities, MSYS2 does not provide a Linux kernel or Linux runtime.

It cannot directly run Linux ELF binaries, use `apt`, provide `systemd`, or reproduce Linux-specific system behavior.

Use MSYS2 when the target is **Windows** and you want Unix/GNU-style development tools.

If the software itself expects POSIX APIs and Unix behavior, another approach like [**Cygwin**](/cs/software-engineering/unix-linux-on-windows-choosing-the-right-environment/cygwin-posix-compatibility-on-windows.md) may be more appropriate.
