1. Perl
  2. Installation

Installing msys2 and Perl on Windows

Explains how to install msys2 and Perl on Windows. The msys2 is a software to build a Linux-like environment on Windows. Perl can be installed on msys2.

On msys2, you can use Linux commands such as ls, cat, tar, and git. The terminal charset is UTF-8.

The msys2 is compatible with POSIX. The Perl web framework such as Mojolicious can work correctly.

Download of msys2

Let's download msys2 from the following page.

Click "the installer: msys2-x86_64-20220319.exe" and donwload msys2 to your desktop.

Installing msys2

Double-click the msys2 icon on your desktop.

Press Next.

Press Finish. The msys2 will start.

Execution of msys2

You close msys2. Next time, you find the msys2 program.

"Windows Start Menu" | "List of Apps" | "MSYS2 64bit".

You will see three msys2 program.

  • MSYS2 MinGW 64bit
  • MSYS2 MINGW 32bit
  • MSYS2 MSYS

Click MSYS2 MSYS. This is needed to run Perl.

"MSYS2 MinGW 64bit" and "MSYS2 MINGW 32bit" are used to create Windows native apps.

Instalation of Perl on msys2

Let's install Perl. pacman is the package manager of msys2.

pacman -S perl perl-CPAN msys2-devel make libcrypt-devel

Copy the above command and paste it on msys2 by clicking the right mouse button.

You will be asked if you want to install them. Press "Enter".

The following softwares will be installed for Perl.

  • perl (perl)
  • cpan (perl-CPAN)
  • gcc (msys2-devel)
  • make (make)
  • crypt.h (libcrypt-devel)

Some Perl modules are written by C/C++ language. To compile these modules, gcc and make are required.

Check of Perl Installation

Checks of Perl installation.

perl -v

If you see the version of Perl, the Perl installation is succeed.

This is perl 5, version 24, subversion 4 (v5.24.4) built for x86_64-msys-thread-multi

Installing CPAN Modules

To make sure your Perl environment is built correctly, install some Perl modules.

Some CPAN modules expect Unix/Linux environments. Make sure the symlink works properly on msys2 with the following command.

export MSYS = winsymlinks

At the first time to use cpan, you will be asked if you want to set cpan automatically. Press "Enter".

cpan Mojolicious
cpan JSON::XS

If the installation of these modules are finished, your Perl environment on msys2 is built correctly.

Related Informatrion