The shell says gradlew: command not found
gradlew: command not foundShort 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.
Fix it fast
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/wrapper2Match what you see, then jump to its fix
- 1
ls shows gradlew in the current folder, but the shell still says command not foundThe command is typed without ./Fix - 2
ls 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
ls finds no gradlew anywhere; the repository was cloned, but the wrapper was never committedThe project has no wrapper filesFix
- 1
What does the error look like?
gradlew: command not foundbash: gradlew: command not foundzsh: 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 gradlew2Fix
Call the script by its path. Windows uses gradlew.bat instead.
./gradlew build3Verify
Print the Gradle version the wrapper downloads and uses.
./gradlew --versionConfirmed by docs.gradle.org
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 tasks3Verify
The task list prints for the whole build.
./gradlew projectsConfirmed by docs.gradle.org
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/wrapper2Fix
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/wrapper3Verify
The generated script runs and downloads the declared distribution on first use.
./gradlew --versionConfirmed by docs.gradle.org
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 fixMobile apps
sdkmanager command not found after installing the Android SDK
bash: sdkmanager: command not found
sdkmanager lives in the Android Command-line Tools package, at cmdline-tools/latest/bin inside the SDK folder.
3 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile 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