MSYS2 ships in the form of installers and base archives. They can be installed or extracted to any place on your computer, but you MUST use folder names that consist of only ascii characters and no spaces (also it makes good sense to put it in a path that doesn't use many characters due to PATH_MAX being 260; C:\msys32 or C:\msys64 is ideal).
You can download the installers or base MSYS2 archives from the links below:
Note: if you are using 64-bit Windows, there is no reason to use 32-bit MSYS2. Well, to be honest, there is one reason: you want to develop MSYS2 software (or contribute to MSYS2-packages) and want to test that the software/package also works on 32-bit MSYS2. When it comes to native software, 64-bit MSYS2 can be used to build, install and run both 32-bit and 64-bit variants. 64-bit MSYS2 software (practically speaking) never needs to be "re-based", giving a better user experience.
The installers and base archives only contain the tools necessary to 1) start MSYS2 2) update the pre-installed packages and 3) install new packages.
* After installing or extracting MSYS2 you should start MSYS2 by executing msys2_shell.bat.
(if you did not use an installer and this is first time running of MSYS2 after unpacking, then at this point it will create the files and settings necessary for it to function properly. After this initial run you MUST restart MSYS2 so that the settings are correct)
- Now you can update the base MSYS2 packages to their latest versions. MSYS2 comes with a package manager Pacman which was ported from Arch Linux.
III. Updating packages
- Before updating you should synchronize your local package databases with the latest repositories:
This command connects to the remote repositories and downloads the package databases.
- The next step is to update the installed packages (do this initially and as often as you want thereafter):
The 'normal' way (don't do this) from Arch Linux would be to simply issue:
.. however, because all MSYS2 programs share the same address space for DLLs due to how MSYS2 (well, Cygwin) implements 'fork', updating bash, MSYS2 or Pacman itself can cause subsequent package updates to fail. For this reason, the safest procedure for updating MSYS2 is to do it in two stages; first those 'core' MSYS2 packages:
pacman --needed -S bash pacman pacman-mirrors msys2-runtime
.. if any packages got updated during this then you MUST restart MSYS2 because files that are provided by these packages will be in use and after update you can get fork errors - you need to exit all MSYS2 shells (and if using MSYS2 32bit, run autorebase.bat) then re-launch msys2_shell.bat
- Finally you can do an update of the remaining packages by issuing:
IV. General Package Management
- Installing new packages:
pacman -S <package_names|package_groups>
For example, pacman -S make gettext base-devel
In this example <base-devel> is a package group which contains many packages. If you try to install a package group, Pacman will ask you whether you want to install one package from the group or all of the packages from the group.
- Removing packages:
pacman -R <package_names|package_groups>
- Searching for packages:
pacman -Ss <name_pattern>
Other pacman options can be found in the Arch Linux wiki.
V. Issues and workarounds
- Please read "III." above, carefully :-) We will continue working towards trouble-free updates.
- If you do run into failures to run post-install scripts, it's really nothing to panic about. Simply make a list of the packages that failed to install correctly, exit all your MSYS2 shells (make sure that they fully exit and no mintty/bash processes are running). Then launch a new MSYS2 shell, and issue:
pacman -S <list-of-packages-that-failed-to-install>
- If you get
error: failed to prepare transaction (could not satisfy dependencies) complaining about
msys2-runtime-devel when you try to update the core, you need to update this package alongside
msys2-runtime and the other core packages.
- Sometimes a package upgrade fails with
failed to commit transaction (conflicting files) and
some-pkg: /path/to/some/file exists in filesystem. If you're sure you didn't put the offending files there manually, move or delete the files and start the upgrade again.
- If your MSYS2 is unable to start after an upgrade, it's possible you just have some lingering MSYS2 processes (loaded with an older version of the runtime) that are conflicting with the processes you're trying to start. Hunt down these processes in you favorite task manager and kill them, or just reboot your system.