Setting up a Unix-like environment in Windows 11

Windows NT is the only major operating system not based on the Unix design. This has made developing software for Windows harder, but thankfully, there are ways to set up a Unix-like environment under Windows.

Recently, Microsoft has been pushing for the use of WSL, but if you want to set up a Unix-like environment for Windows natively, you can follow the following tutorial.

Installing a Unix-like command set and interpreter

Step 1: Install Git for Windows

Git for Windows comes with not only Git, but also Git Bash, which ships with GNU bash and GNU coreutils. You can download a standalone installer from the official download page for Windows.

Step 2: Make bash the default in Windows Terminal

Open Windows Terminal. If you don't have it, make sure to install it from the Microsoft Store.

You will then need to create a new Windows Terminal profile. You can follow the steps in this external tutorial if you don't know how. Make sure you specify the correct path to the Git Bash executable so that your new profile launches with the correct command interpreter.

To make life easier for you, you can change the Windows Terminal settings to set your new Git Bash profile as the default. This will allow Windows Terminal to open up with Git Bash by default, instead of PowerShell.

Installing a C toolchain

If you want a Unix-like environment, chances are that you'll want a C toolchain, including a compiler, linker, debugger, and so on. To do this, you can install LLVM-MinGW.

Step 1: Download the release bundle

First of all, head to the LLVM-MinGW releases page. At the top of the page is the latest release, with a list of downloadable archive files with the LLVM-MinGW distribution for different systems. Download the zip file ending with:

Extract the contents of the zip file to a new folder. We will need them later.

Step 2: Create the installation folder

The zip file you downloaded does not come with an installer. This means you need to manually extract the LLVM-MinGW distribution into a system folder.

In this guide, we will create and use the folder C:\Program Files\llvm\. You may choose another folder to install to if you wish. Make sure the folder exists and that the folder is empty.

Step 3: Copy the distribution

Copy the contents of the extracted zip file (not the folder!) into the installation folder you created in step 2. After the copying completes, your installation folder's contents should look like this:


Step 4: Add the LLVM toolchain to PATH

You will now need to add your chosen installation folder, suffixed with \bin, to the system PATH variable. If you are unsure about how to do this, consult the following external guide:

For instance, if your installation folder was C:\Program Files\llvm\, the path that you would need to add to the system PATH variable is C:\Program Files\llvm\bin