Unable to find bash.exe executable when using MinGW

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

Problem

When running a Bash script on a 64-bit Windows 10 machine with MinGW installed, the following error appears in the job log:

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:

    #!/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.

Resolution

Change the Shebang line to use the Windows style path to bash.exe. For example:

#!C:\msys64\usr\bin\bash.exe
Last modified on Jan 25, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.