Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

The shell says gradlew: command not found

Errorgradlew: command not found

Short answer

The shell cannot find a launcher called gradlew. Run it with a leading ./ from the folder that contains it, or give the path to the root copy when you are in a subproject. If no gradlew file exists, the project has no wrapper yet: generate it once with an installed Gradle and commit the files.

  • Applies to Gradle 8.14, Gradle 9, Ubuntu 24.04, macOS 15
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether a gradlew file exists in the folder you are in. If it is listed, the problem is how you call it (cause 1). If it is not, look in the parent folders (cause 2) and then decide whether the project has a wrapper at all (cause 3).

    pwd
    ls -l gradlew gradle/wrapper
  2. 2Match what you see, then jump to its fix

    1. 1ls shows gradlew in the current folder, but the shell still says command not foundThe command is typed without ./Fix
    2. 2ls gradlew prints nothing in app/ or another module folder, but the repository root has the fileYou are inside a subproject folder, not at the rootFix
    3. 3ls finds no gradlew anywhere; the repository was cloned, but the wrapper was never committedThe project has no wrapper filesFix

What does the error look like?

  • gradlew: command not found
  • bash: gradlew: command not found
  • zsh: command not found: gradlew

Cause 1 of 3

The command is typed without ./

1Check

The shell looks for commands on its search path, and the current folder is not on it. Gradle's documentation always writes the call with ./ on macOS and Linux.

ls -l gradlew

2Fix

Call the script by its path. Windows uses gradlew.bat instead.

./gradlew build

3Verify

Print the Gradle version the wrapper downloads and uses.

./gradlew --version

Confirmed by docs.gradle.org

Did this fix it?

Cause 2 of 3

You are inside a subproject folder, not at the root

1Check

The wrapper scripts live in the root project only. Walk up and look for settings.gradle(.kts) next to gradlew.

ls ../gradlew ../settings.gradle*

2Fix

Run the root script by relative path, or change to the root folder first. Gradle's example for a subproject is ../../gradlew.

cd ..
./gradlew tasks

3Verify

The task list prints for the whole build.

./gradlew projects

Confirmed by docs.gradle.org

Did this fix it?

Cause 3 of 3

The project has no wrapper files

1Check

Gradle's guide lists gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar and gradle/wrapper/gradle-wrapper.properties as the files to check into version control. If they are not in the clone, they are not in the repository.

git ls-files gradlew gradle/wrapper

2Fix

With a Gradle installation, generate the wrapper at the root project (the colon targets the root), then commit the four files. Add --gradle-version to pin the version.

gradle :wrapper --gradle-version 8.14
git add gradlew gradlew.bat gradle/wrapper

3Verify

The generated script runs and downloads the declared distribution on first use.

./gradlew --version

Confirmed by docs.gradle.org

Did this fix it?

How do I stop it coming back?

  • Commit gradlew, gradlew.bat and the gradle/wrapper folder with the project.
  • Write ./gradlew in README, scripts and CI instead of a global gradle command.
  • Update the wrapper with the wrapper task and run it twice, as the guide describes, so all the files change together.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

./gradlew will not run: permission denied

zsh: permission denied: ./gradlew

The gradlew script has lost its executable bit, usually after a zip download, a Windows checkout or a copy to another disk.

3 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.