How to install MSYS so that it recognizes non-MSYS binaries?

I have noticed that my MSYS bash doesn’t "know" about the environment variables defined on my system. This means that if the folder C:MyStuffbin is in my path, and that folder contains mycommand.exe, then running mycommand in the MSYS terminal will return an error indicating that it could not be found.

How do I cleanly "integrate" MSYS with the rest of my system? Is that something to be avoided?

Super User Asked on November 14, 2021

1 Answers

One Answer

How do I cleanly "integrate" MSYS with the rest of my system?

I use Cygwin (which is similar to msys in the way it works) and selectively add parts of my Windows PATH to my bash PATH as follows:

I have a file (.path_elements) containing the directories I want in my bash path:


Note: if you add lines to your .path_elements file they must be terminated by : (except for the last line).

I modified my .bash.profile file as follows:

#DCP 20151019 comment out the original code for setting PATH
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
#   PATH="${HOME}/bin:${PATH}"
# fi

#DCP 20151019
# Build up the path using the directories in ~/.path_elements
unset PATH
while read line; do 
done < ~/.path_elements


#DCP 20151019
# Add current directory to path
export PATH=".:${PATH}"

Now in my bash shell:

$ echo $PATH

You should be able to do something very similar in msys.

Answered by DavidPostill on November 14, 2021

Add your own answers!

Related Questions

IPv6 IPv4-like DHCP Binding

0  Asked on August 8, 2020 by dork


Virus / malware stored inside database

1  Asked on August 7, 2020 by adam-przedniczek


I can’t install pip for python 3.5

1  Asked on August 6, 2020 by dev


Speeding up a fan running in ‘dumb’ mode

1  Asked on August 3, 2020 by laserguy


Add myself as owner again of a team in Microsoft Teams

1  Asked on August 1, 2020 by finn-rup-nielsen


Two Interfaces and lost packages

1  Asked on July 26, 2020 by cicekadam


Ask a Question

Get help from others!

© 2021 All rights reserved.