Search code examples
windowsmakefilecygwin

Cygwin doesn't recognize make command despite it being installed and in the bin folder


I've been trying to run software on my W10 PC that requires make, this lead me to installing Cygwin. When looking Cygwin up I saw that I needed to install make from the Devel category, which I did the first time I installed Cygwin. I receieved the following message my first time trying to execute make:

bash: make: command not found

I tried reinstalling make (the drop down literally said "Reinstall") and checking if make.exe was in the bin folder but I still got the same error. I reinstalled it a second time but checked the src box this time hoping that would help, but it didn't.

The only other piece of information I can think to add is that the Makefile that I'm trying to make is in a folder in my Documents folder in my C drive (C:\Users\myname\Documents\folder\folder_with_Makefile). I checked the Cygwin FAQ and it mentions that the Cygwin root directory isn't the same as my drives root directory by design, and to only change it if "you know what you are doing", which I clearly don't. I'm not sure if that might be the cause of my issue but I'd appreciate any help.


Output of echo $PATH:

/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/Calibre2:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/CMake/bin:/cygdrive/c/Users/myname/AppData/Local/Programs/Python/Python39/Scripts:/cygdrive/c/Users/myname/AppData/Local/Programs/Python/Python39:/cygdrive/c/Users/myname/.cargo/bin:/cygdrive/c/Users/myname/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/JetBrains/PyCharm Community Edition 2020.2.2/bin:/cygdrive/c/Users/myname/AppData/Local/atom/bin:/cygdrive/c/Users/myname/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/JetBrains/IntelliJ IDEA Community Edition 2020.3.3/bin

This is where cygwin is installed: C:\cygwin64


Solution

  • Please see below changes which will help you to set the PATH variable correctly with cygwin. You can perform the following changes.

    Open the file profile.bashrc present in etc/ directly where cygwin is installed.
    Add below lines.

    # Save Windows path variable
    export WINPATH=$PATH
    export PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
    

    Open bash.bashrc file present in etc/ directly where cygwin is installed. Add below lines

    # The next block is only needed in case somebody starts a shell without --login parameter in the beginning (no /etc/profile invoked)
    # The WINPATH variable is set in /etc/profile and contains the original Win PATH variable content
    if [ -z "${WINPATH}" ] ; then
       export WINPATH=$PATH
    fi
    # Set PATH variables
    export PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:${WINPATH}
    export MANPATH=/usr/local/man:/usr/share/man:/usr/man