486

I'm following the instructions of someone whose repository I cloned to my machine. I want to use the make command as part of setting up the code environment, but I'm using Windows.

I searched online, but I could only find a make.exe file, a make-4.1.tar.gz file (I don't know what to do with it next) and instructions for how to download MinGW (for GNU; but after installing it, I didn't find any mention of "make").

How do I use make in Windows without a GNU compiler or related packages?

1
  • 13
    Merely installing make is unlikely to solve your problem. Many Makefiles are written for Unix-like systems and will require you to install a significant amount of additional utilities (including a supported compiler if the project involves compiled code) such as Cygwin, or simply switching to a platform like WSL if you really cannot free yourself from Windows entirely. Commented Jun 8, 2019 at 15:40

15 Answers 15

659

make is a GNU command, so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:

  1. Directly download from Make for Windows

  2. Using Chocolatey. First, you need to install this package manager. Once installed, you simply need to install make (you may need to run it in an elevated/administrator command prompt):

    choco install make
    
  3. Another recommended option is installing a Windows Subsystem for Linux (WSL or WSL 2), so you'll have a Linux distribution of your choice embedded in Windows 10, where you'll be able to install make, gcc, and all the tools you need to build C programs.

  4. For older Windows versions (Microsoft Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, or Windows 7 with msvcrt.dll) you can use GnuWin32.

An outdated alternative was MinGW, but the project seems to be abandoned, so it's better to go for one of the previous choices.

Sign up to request clarification or add additional context in comments.

18 Comments

A simpler way would be to create a symlink: mklink C:\bin\make.exe C:\MinGW\bin\mingw32-make.exe. So in the future if you do upgrade your mingw, the link would be intact.
Just using MSYS2 I wasn't able to use mklink. MSYS2's pacman can install a make pacman -S make, which is not working correctly. Instead, mingw32-make.exe was already present in msys64/mingw64/bin. Maybe it shipped with gcc. I'm confused why it's not just called make.exe, though. I just copied it to make.exe.
Maybe useful to mention that Visual Studio ships its own 'make' utility, nmake, see the doc. It's usable from the VS command prompt, but you can of course add it to the path. Note however that the functionalities are quite limited compared to GNU make, and the documentation is almost nonexistent...
@notacorn kind of, but you can access your "Windows" folders from both of them. Git bash with /c, WSL with /mnt/c.
"Make is a GNU command"... sorta, but NOT EXACTLY. The original Make many decades ago was a Unix tool. Then GNU cloned it. Then GNU enhanced it _extensively, so much so that they had to abandon backward compatibility. The GNU version is so much better that very few use the original Unix version any more and it has largely disappeared. Many Linux systems contain both the original Make (called 'make') and the GNU version Make (called 'gmake').
|
325

GNU Make is available on Chocolatey.

  • Install Chocolatey from here.

  • Then, choco install make.

Now you will be able to use Make on Windows. I've tried using it on MinGW, but it should work on CMD as well.

4 Comments

Note: One may need to set the correct proxy using choco config set proxy ADDRESS:PORT
There's also scoop if you don't like how chocolaty requires an admin powershell session: github.com/lukesampson/scoop/wiki/Chocolatey-Comparison
And how do I get configure then?
It seems chocolatey should not be used for commercial use chocolatey.org/terms?
145

On Windows 10 or Windows 11, you can install ezimports.make by running the command winget install ezwinports.make in the command line or PowerShell to quickly install it, restart the command line or PowerShell. Then you can use the command make.

There isn't any need to install Chocolatey (executable choco) anymore.

15 Comments

this almost works. You also need to add C:\Program Files (x86)\GnuWin32\bin to the windows PATH environment variable.
The executable file is also called make.exe and not cmake.exe, so the command is also make
make is newest on choco. choco make --version - GNU Make 4.4.1, winget make --version - GNU Make 3.81
This answer should be on the top.
This is the answer as of 2024. Worked flawlessly without the need to install anything else. Also, to date, this will modify your path to accordingly, so Joba's comment is outdate.
|
29

Eduardo Yáñez Parareda's answer is a bad idea in general, because the manually created make.exe will stick around and can potentially cause unexpected problems. It actually breaks RubyInstaller: No rule to make target '/ruby.h' when make.exe is present in <OTHER_PATH>/mingw64/bin #105

An alternative is installing make via Chocolatey (as pointed out by Vasantha Ganesh K).

Another alternative is installing MSYS2 from Chocolatey and using make from C:\tools\msys64\usr\bin. If make isn't installed automatically with MSYS2, you need to install it manually via pacman -S make (as pointed out by Thad Guidry and Luke).

3 Comments

I installed this using Chocolatey but there is no make.exe in C:\tools\msys64\usr\bin ??
you can find pacman in that folder, after that use step 3 of @thad
remember to enable ridk using ridk enable, before pacman -S make
21
  1. Install MSYS2
  2. Follow the installation instructions
  3. Install make with pacman -S make gettext base-devel
  4. Add C:\msys64\usr\bin\ to your path

1 Comment

After step 2, remember to enable ridk using ridk enable
21

If you're using Windows 10, it is built into the Linux subsystem feature. Just launch a Bash prompt (press the Windows key, type bash and choose "Bash on Ubuntu on Windows"), cd to the directory you want to make, and type make.

FWIW, the Windows drives are found in /mnt, e.g., the C:\ drive is /mnt/c in Bash.

If Bash isn't available from your start menu, here are instructions for turning on that Windows feature (64-bit Windows only):

5 Comments

it does not work. the shell dissapears instantly
This doesn't answer the question, because it doesn't install it In Windows. The make used here will be part of a build chain that will build Linux binaries, rather than Windows ones.
it may not answer the question, but solves my problem. install using $ sudo apt install make
Whether this is acceptable or not depends on the specific Makefile. A tooling pipeline which doesn't compile binaries for any specific platform is likely to work fine if you have the required tools; a Makefile to compile a C (or Fortran, C++, etc) project probably won't work for many, many reasons, including (as pointed out in a previous comment) the fact that if it does work, the end result is not a valid Windows binary.
@jayfall The apt package manager is specific to Debian Linux and derived distributions like Ubuntu. This is what WSL runs out of the box, but you can configure it to run other Linux variants which require a different package manager. For RPM-based distros like CentOS and Fedora, there's yum and dnf; for Alpine etc there's apk, Arch uses pacman etc etc
20

Download make.exe from their official site GnuWin32

  • In the Download session, click Complete package, except sources.

  • Follow the installation instructions.

  • Once finished, add the <installation directory>/bin/ to the PATH variable.

Now you will be able to use make in cmd.

3 Comments

Could you please help me how to set the directory to the PATH variable.
@shomit Start a windows OS search (the box next to the windows button) for the word "Environment" When you see the popup for Edit the System Environment Variables in the Control Panel, Select that. System Properties --> Advanced tab app should popup. Look for the button at the bottom that says "Environment Variables"
This does not work. I did this and I got the error that the program was build for 32 bits systems and win10 is 64 bits. Is there a make for windows 10?
15

The chances are that besides GNU make, you'll also need many of the GNU Core Utilities. touch, rm, cp, sed, test, tee, echo and the like.

The build system might require Bash features, if for nothing else, it's popular to create temporary file names from the process ID ($$$$). That won't work without Bash. You can get everything with the popular POSIX emulators for Windows:

  • Cygwin. It is probably the most popular one and the most compatible with POSIX. It has some difficulties with Windows paths, and it's slow.
  • GnuWin. It was good and fast, but it is now abandoned. No Bash is provided, but it's possible to use it from other packages.
  • ezwinports. My current favorite. It is fast and works well. There isn't any Bash provided with it, and that can be a problem for some build systems. It's possible to use Make from ezwinports and Bash from Cygwin or MSYS2 as a workaround.
  • MSYS 1.19 is abandoned. It worked well, but it featured a very old Make (3.86 or so)
  • MSYS2 works well and is the second fastest solution after ezwinports. Good quality, package manager (Pacman), and all tooling is available. I'd recommend this one.
  • MinGW: Abandoned? There was usually MSYS 1.19 bundled with MinGW packages that contained an old make.exe. Use mingw32-make.exe from the package, that's more up-to-date.

Note that you might not be able to select your environment. If the build system was created for Cygwin, it might not work in other environments without modifications (the Make language is the same, but escaping, path conversion are working differently, $(realpath) fails on Windows paths, DOS bat files are started as shell scripts and many similar issues). If it's from Linux, you might need to use a real Linux or WSL.

If the compiler is running on Linux, there isn't any point in installing Make for Windows, because you'll have to run both Make and the compiler on Linux. In the same way, if the compiler is running on Windows, WSL won't help, because in that environment you can only execute Linux tools, not Windows executables. It's a bit tricky!

Comments

9

You can also install scoop. Then run:

scoop install make

1 Comment

This return error "Couldn't find manifest for 'make'."
7

I could suggest a step-by-step approach.

  1. Visit GnuWin
  2. Download the Setup Program
  3. Follow the instructions and install GnuWin. You should pay attention to the directory where your application is being installed. (You will need it later)
  4. Follow these instructions and add make to your environment variables. As I told you before, now it is time to know where your application was installed. FYI: The default directory is C:\Program Files (x86)\GnuWin32\
  5. Now, update the PATH to include the bin directory of the newly installed program. A typical example of what one might add to the path is: ...;C:\Program Files (x86)\GnuWin32\bin

Comments

6

I once had the same problem. But I am surprised not to find one particular solution here.

Installation from GnuWin32 or via winget are good and easy options. But I only found make 3.8.1 there. This version lacks the very important option -O, which handles the output correctly when compiling multithreaded.

choco (Chocolatey) appears to offer make 4.3, currently. So one could expect recent versions there.

But there is also the option of self compiling. And if you have to install make, which is used for compiling, this should be a valid option.

  1. head to GNU Make and download a version of your liking
  2. unpack the .tar.gz files (use 7-Zip and unpack the file twice to retrieve the actual content)
  3. navigate to the created directory
  4. open a command prompt in that directory
  5. run build_w32.bat gcc. This will start the compilation with the GCC compiler, which you would need to install in advance. When running build_w32.bat without any options, they try to use the MSVC compiler. Side note: I found it surprising that GNU does not use GCC as default, but MSVC :-)
  6. ignore the warnings created during compilation. The result should still be fine
  7. retrieve your fresh gnumake.exe from the directory GccRel (when compiled with GCC)
  8. put this file somewhere where you like, and rename it to make.exe
  9. add the location to the system variable %PATH%

As others have noted: This manual installation might cause conflicts if you have various Make versions installed by other programs as well.

Comments

4

Another alternative is if you already installed MinGW and added the bin folder to the Path environment variable, you can use "mingw32-make" instead of "make".

You can also create a symbolic link from "make" to "mingw32-make", or copying and changing the name of the file. I would not recommend the options before; they will work until you do changes on the MinGW installation.

Comments

0

One solution that may helpful, if you want to use the command line, is emulator Cmder. You can install the package installer chocately. First we install Chocolatey in the Windows command prompt using the following line:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
refreshenv

After Chocolatey is installed, the choco command can be used to install Make. Once installed, you will need add an alias to /cmder/config/user_aliases.cmd. The following line should be added:

make="path_to_chocolatey\chocolatey\bin\make.exe" $*

Make will then operate in the Cmder environment.

Comments

0

To elaborate on Eduardo Yáñez Parareda's answer's first option by using (Make for Windows) for installing Make above:

  1. The default install of GnuWin32 on Windows 11 was in Program Files (x86). I set up my environment variables PATH to point to the bin folder with the make.exe file, but for whatever reason, this location did not work.

  2. When I moved the GnuWin32 folder to Program Files (without the "(x86)") and changed the environment variables PATH accordingly, it worked as expected.

  3. You likely need to restart your computer as it appears that the PATH variables are cached at the start of sessions.

Comments

-4
  1. Install npm

  2. install Node.js

  3. Install Make

    node install make up
    node install make
    
  4. If the above commands displays any error, then install Chocolatey (executable choco)

  5. Open cmd and copy and paste the below command (command copied from Chocolatey URL)

    @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
    

1 Comment

There's a deleted answer from 2018 with the same proposal. It has the following comment: 'npm's make package is not the same thing as GNU Make which most build scripts expect: it's a reimplementation of make in JavaScript that is not guaranteed to be entirely compatible with traditional makefiles, this is documented in the package's page on npm: "The parser make.js uses is small and has its flaws, but for most Makefiles, make.js is able to parse them correctly." - so this is not what the OP is looking for.'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.