Unable to find bash.exe executable when using MinGW
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
When running a Bash script on a 64-bit Windows 10 machine with MinGW installed, the following error appears in the job log:
1
Unable to find executable at /usr/bin/bash.exe. Will try to run it anyway.
Diagnosis
Environment
Windows 10
MinGW 64
Bash Script
Diagnostic Steps
Please check the Shebang line of the script; eg:
1
#!/usr/bin/bash.exe
– this article applies if the path to
bash.exe
is in Unix format.
Cause
Even though /usr/bin/bash
exists, it cannot be found by the agent's Shell interpreter.
Solution
Resolution
Change the Shebang line to use the Windows style path to bash.exe
. For example:
1
#!C:\msys64\usr\bin\bash.exe
Was this helpful?