zsh: command not found: mvn
command-not-found
Updated August 29, 2026
zsh: command not found: mvn means Maven's bin directory is not on the current PATH. Check Java and the command separately:
java --version
command -v mvn
For an existing Maven installation, add its bin directory using the setup instructions for your operating system, reload zsh, and verify:
source ~/.zshrc
mvn --version
Many projects include the Maven Wrapper. In that case you do not need a global Maven installation:
./mvnw test # macOS/Linux
./mvnw.cmd test # Windows
The wrapper still needs a compatible Java runtime. Do not “fix” the error by placing a random Maven directory in PATH; check MAVEN_HOME, the project README, and the official Maven installation page. If a command works in one terminal but not another, compare shell startup files and the value of PATH rather than reinstalling the project.
Sources
related.
Ruslan Osipov
About the author