Recover Cygwin after MKS Toolkit installation

0

I used to use Cygwin on my Windows desktop for a while and was happy until I installed some other app recently. This app itself is not relevant here (let's call it ABC app), the main thing that it has installed MKS Toolkit along with it. Since I was installing the app as administrator the installation manager added MKS Toolkit at the beginning of system PATH variable. Now MKS Toolkit shadows/hides Cygwin and Cygwin is actually broken. I could remove MKS Toolkit from system PATH, as I'm not going to use it directly, but I'm not sure how it will affect the ABC app.

The question is: Is there any way I can keep MKS Toolkit at the beginning of system PATH and use Cygwin at the same time? If yes, then what should be done for this?

This is how I had run Cygwin (the default shortcut actually):

<my_path_to_cygwin>\bin\mintty.exe -i /Cygwin-Terminal.ico -

What I have in Cygwin now:

echo $PATH
C:\Program Files (x86)\MKS Toolkit\mksnt;C:\PROGRA~2\MKSTOO~in64;C:\PROGRA~2\MKSTOO~in;C:\PROGRA~2\MKSTOO~in\X11;...the rest of the PATH...

which bash
C:/Program Files (x86)/MKS Toolkit/mksnt/bash.exe

What I have in cmd.exe:

echo %PATH%
C:\Program Files (x86)\MKS Toolkit\mksnt;C:\PROGRA~2\MKSTOO~1\bin64;C:\PROGRA~2\MKSTOO~1\bin;C:\PROGRA~2\MKSTOO~1\bin\X11;...the rest of the PATH...

which bash
C:/Program Files (x86)/MKS Toolkit/mksnt/bash.exe

Side note: I also have GitBash and seems it has not been affected by MKS Toolkit.

What I have in GitBash:

$ echo $PATH
/c/Users/<username>/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files (x86)/MKS Toolkit/mksnt:/c/PROGRA~2/MKSTOO~1/bin64:/c/PROGRA~2/MKSTOO~1/bin:/c/PROGRA~2/MKSTOO~1/bin/X11:...the rest of the PATH...
$ which bash
/bin/bash

PetroCliff

Posted 2018-12-27T23:43:08.540

Reputation: 101

Why Cygwin should be broken ? It redefines its own path with PATH="/usr/local/bin:/usr/bin${PATH:+:${PATH}}"` so the Cygwin programs are always coming first. – matzeri – 2018-12-28T06:29:14.870

matzeri, I had added the result of which bash execution. As you can see mintty starts bash from MKS Toolkit, not from Cygwin. The same case is for all other UNIX-like programs, that are in MKS Toolkit\mksnt directory: cp, less, vi etc. – PetroCliff – 2018-12-28T16:35:26.947

matzeri, I've found where cygwin redefines its own path that you mentioned - it's in /etc/profile, right? But looks like it is not executed. – PetroCliff – 2018-12-28T16:46:08.430

Answers

0

I've read mintty man carefuly (https://mintty.github.io/mintty.1.html) and found that:

If a program name is supplied on the command line, this is executed with any additional arguments given. Otherwise, mintty looks for a shell to execute in the SHELL environment variable. If that is not set, it reads the user’s default shell setting from /etc/passwd. As a last resort, it falls back to /bin/sh.

So, I added a user-level env variable SHELL with /bin/bash value and it recovered my Cygwin. I dind't have to modify mintty shortcut target.

PetroCliff

Posted 2018-12-27T23:43:08.540

Reputation: 101