Setup Msys2 automatically

Some time ago I wrote a short post on “How to develop a 64bit C application on Windows 10 with Visual Studio Code“.

To be honest´it is a little bit tricky setting up the development environment, with gcc, gdb, make and other required tools. So I have extended my automated installation script.

This script will:

  • Install Msys2 in “%LocalAppData%\Programs\Msys2” (Under your user directory. Thus, no admin privileges are required.
  • Install all the required tools for development like compiler, linker, debugger, etc.
  • Update everything to the latest version.

If you download the file from the repository it is possible that PowerShell will ask you if you really want to run the file. You can prevent this from happening with the following command:

Unblock-File -Path install.ps1
Are you sure you want to perform this action?
Performing the operation "Unblock-File" on target "C:\Users\Path\to\download\directory\install.ps1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

There will be a console windows flashing up a few times. When everything is done the regular prompt of PowerShell is shown.