Skip to main content

Usage Guide for MSYS2 Software Repository Mirrors

Introduction and Usage Scenarios of MSYS2

MSYS2 is a software distribution for Windows that provides an environment similar to Unix. It is based on the modern Cygwin and MinGW-w64 projects, aiming to offer developers a powerful platform for building and development. MSYS2 uses the pacman package manager, (which is the same as Arch Linux), making it convenient to install, update, and manage software packages. It provides an environment akin to Unix systems, making cross-platform development on Windows easier. MSYS2 includes a vast array of pre-compiled packages, including compilers, libraries, tools, and so on.

Inclusive Architecture

  • MinGW: i686, x86_64, ucrt64, clang64
  • MSYS: i686, x86_64

Download and Installation of MSYS2

Please visit the distrib/ directory under the mirror directory:

x86_64

i686

Usage Details

Find the file named msys2-<architecture>-<date>.exe(such as msys2-x86_64-20141113.exe), and then download and install it.

The configuration of pacman within MSYS2

caution

To avoid issues after replacing the software source configuration file, please first back up the system's default software source configuration file, and then proceed with the following steps.

Manual Source Replacement

  1. Edit the/etc/pacman.d/mirrorlist.mingw32 file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/i686
  1. Edit the /etc/pacman.d/mirrorlist.mingw64 file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/x86_64
  1. Edit the /etc/pacman.d/mirrorlist.msys file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/msys/$arch
  1. Edit the /etc/pacman.d/mirrorlist.ucrt64 file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/ucrt64
  1. Refresh the software package database:
Are you the root user?
sudo pacman -Sy

Through these steps, you can change the mirror source of MSYS2 to the mirror station of Huazhong University of Science and Technology, thus speeding up the download and update of software packages.

One-click source replacement

caution

This method is only applicable to changing from the official source to the source of this site. If you have already changed the source, please do not use the following commands.

You can use the following command to change the mirror source of MSYS2 to the mirror station of Huazhong University of Science and Technology with one click:

Are you the root user?
sudo sed -i "s#https\?://mirror.msys2.org/#https://mirrors.hust.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*

Quote

  1. MSYS2 Mirror Site Usage Help | Alibaba Cloud Open Source Mirror Station
  2. MSYS2 Mirror Site Usage Help | Tsinghua University Open Source Software Mirror Station
Choose your prefered domain
mirrors.hust.edu.cn
This domain is Dual Stack
Enable HTTPS