In MSYS2, packages are installed into different environments based on the type of package and the environment you are using. Here are the main environments:
- MSYS: Contains Unix-like tools and is always active. Packages installed here are placed under /usr.
- MINGW32: For 32-bit MinGW-w64 packages, installed under /mingw3.
- MINGW64: For 64-bit MinGW-w64 packages, installed under /mingw64.
- UCRT64: Uses the Universal C Runtime, installed under /ucrt64.
- CLANG32: Uses the Clang toolchain for 32-bit, installed under /clang32.
- CLANG64: Uses the Clang toolchain for 64-bit, installed under /clang64.
MSYS2 How to know which is the default environment.
echo $MSYSTEM
This command will display the current environment, such as MSYS, MINGW32, MINGW64, UCRT64, CLANG32, or CLANG64
MSYS2 How to change the default environment ?
To change the default environment in MSYS2, you can set the MSYSTEM environment variable to the desired environment. Here’s how you can do it:
- Open MSYS2 Terminal: Start the MSYS2 terminal.
- Set the Environment Variable: Use the “export” command to set the “MSYSTEM” variable. For example, to switch to the “MINGW64” environment, you would use: export MSYSTEM=MINGW64
- You can also create a shortcut that opens MSYS2 with a specific environment. Here’s how:
- Create a Shortcut: Right-click on your desktop and select New > Shortcut.
- Enter the Path: Enter the path to the MSYS2 executable followed by the desired environment.
For example: C:\msys64\msys2_shell.cmd -mingw64 - Name the Shortcut: Give your shortcut a name, like “MSYS2 MINGW64”, and click Finish.
Now, you can use this shortcut to open MSYS2 directly in the “MINGW64” environment.
Once you change the default environment to MINGW64 and run the pacman -Suy command, the packages will be installed in the MINGW64 environment. Specifically, they will be placed under the /mingw64 directory.