Skip to content

Instantly share code, notes, and snippets.

@tc-imba
Last active May 18, 2024 05:41
Show Gist options
  • Save tc-imba/93f299136b5a765aa2d176914d8e25cd to your computer and use it in GitHub Desktop.
Save tc-imba/93f299136b5a765aa2d176914d8e25cd to your computer and use it in GitHub Desktop.
Install msys2 with choco

Introduction

Chocolatey is the package manager for Windows.

You can install the msys2 environment with chocolatey, and install mingw in msys2.

Procedure

  1. Open the Windows Powershell with administration user.
  2. Run the install script from Chocolatey.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  1. Run
choco install -y msys2
  1. Close Powershell and open the directory C:\tools\msys64\etc\pacman.d

  2. There are three mirror files in it:

    • mirrorlist.mingw32
    • mirrorlist.mingw64
    • mirrorlist.msys

    Open and delete every line of them except the line with https://mirrors.tuna.tsinghua.edu.cn

  3. Open msys2 by C:\tools\msys64\msys2.exe

  4. Refresh the pacman database

pacman -Sy
  1. Install the mingw toolchain and some other utils in msys2
pacman -S mingw-w64-x86_64-toolchain libraries development compression VCS sys-utils net-utils msys2-devel mingw-w64-x86_64-cmake

You may check https://www.jianshu.com/p/c740b71e7775 for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment