-bash kafka-server-start.sh command not found
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
If you try to run the command kafka-server-start.sh in your shell and receive the error -bash: kafka-server-start.sh: command not found, it indicates that your system’s Bash shell cannot locate the script required to start Apache Kafka. Apache Kafka is a distributed streaming platform used widely for building real-time data pipelines and streaming apps. Understanding the reasons behind this error and how to resolve it will be essential for successfully operating Kafka on your machine.
Understanding the Error
This error can occur for a variety of reasons, primarily revolving around the setup and configuration environment of Kafka on your system. Here are the main causes:
- Kafka is not installed: You might not have Kafka installed on your system, or the installation was not completed successfully.
- Incorrect PATH environment variable: The location of the
kafka-server-start.shscript isn’t included in the system’s PATH, so the shell doesn’t know where to find it. - Directory confusion: You might be in the wrong directory and not where the
kafka-server-start.shfile resides.
Resolving the Error
To address this issue, follow these corrective steps:
1. Verify Kafka Installation
Ensure that Apache Kafka is indeed installed on your machine. The typical installation involves downloading a release from Apache Kafka's website and extracting it to a local directory.
Example Installation on Unix-based system:
2. Check the Current Directory
Ensure that you are in the directory where kafka-server-start.sh exists. This script is usually found in the bin directory of where Kafka was unpacked.
3. Modify the PATH Environment Variable
If you want to run the Kafka scripts from any directory, add the Kafka bin directory to your PATH environment variable:
Insert this line in your shell profile file (like .bashrc or .zshrc) to make this change permanent.
4. Using the Full Path
Alternatively, you could also start Kafka by specifying the full path to the script:
5. Permissions Issue
Check if the script has executable permissions; if not, you can set them using:
Troubleshooting Further
If you've tried the above solutions and still face issues, consider the following:
- Examine the script to ensure it's not corrupted.
- Re-download and reinstall Kafka in case of corrupt files.
- Verify dependencies like Java are installed and properly configured, as Kafka requires Java.
Summary Table of Key Solutions
| Issue | Resolution Steps |
| Kafka not installed | Download and install Kafka from the official website |
| Missing from PATH variable | Add Kafka bin directory to PATH |
| Incorrect directory | Navigate to the correct bin directory of Kafka |
| Lack of execution permissions | Use chmod to set execute permissions on the script |
Conclusion
Encountering the -bash: kafka-server-start.sh: command not found error is a common hiccup for many developers and system administrators setting up Kafka for the first time. By systematically verifying the installation, adjusting environment variables, and ensuring script accessibility, you can resolve this error efficiently and get your Kafka server running smoothly.
Related reading
- 100% cpu usage by all kafka brokers
- 1 Kafka topic with consumer filters vs. many topics without consumer filters
- ActiveMQ or RabbitMQ or ZeroMQ
- Apache Kafka vs Apache Storm
- -didSelectRowAtIndexPath not being called
- -Dlogback.configurationFilelogback.xml ignored when running Spring-Boot
- Can multiple Kafka consumers read same message from the partition
- Data Modeling with Kafka? Topics and Partitions

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.