15.3 A.2 macOS
Two options: Homebrew (simple) or manual ("for greater control over versions").
"macOS runs on Darwin, a Unix OS that is derived, in part, from FreeBSD. This means that many of the expectations of running on a Unix OS hold true, and installing applications designed for Unix, like Apache Kafka, is not too difficult."
Two options: Homebrew (simple) or manual ("for greater control over versions").
Option 1: Homebrew — one step
brew install kafka
# ==> Installing dependencies for kafka: openjdk, openssl@1.1 and zookeeper
# ==> /usr/local/Cellar/kafka/2.8.0: 200 files, 68.2MB"The Homebrew package manager will ensure that you have all the dependencies installed first, INCLUDING JAVA."
Where things land — "Homebrew will install Kafka under /usr/local/Cellar, but the files will be linked into other directories":
| What | Where it is linked |
|---|---|
| Binaries and scripts | /usr/local/bin |
| Kafka configurations | /usr/local/etc/kafka |
| ZooKeeper configurations | /usr/local/etc/zookeeper |
log.dirs — the data | /usr/local/var/lib/kafka-logs |
/usr/local/bin/zkServer start
# Using config: /usr/local/etc/zookeeper/zoo.cfg
# Starting zookeeper ... STARTED
/usr/local/bin/kafka-server-start /usr/local/etc/kafka/server.properties
# ... INFO [KafkaServer id=0] started(This example starts Kafka in the foreground.)
Option 2: manual
Same shape as the Windows manual install: download the JDK from the Oracle Java SE page, download Kafka, expand it (example: /usr/local/kafka_2.13-2.8.0).
"Starting ZooKeeper and Kafka looks just like starting them when using Linux, though you will need to make sure your
JAVA_HOMEdirectory is set first:"
export JAVA_HOME=`/usr/libexec/java_home -v 16.0.1`
echo $JAVA_HOME
# /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home
/usr/local/kafka_2.13-2.8.0/bin/zookeeper-server-start.sh -daemon \
/usr/local/kafka_2.13-2.8.0/config/zookeeper.properties
/usr/local/kafka_2.13-2.8.0/bin/kafka-server-start.sh \
/usr/local/kafka_2.13-2.8.0/config/server.properties💡 /usr/libexec/java_home -v <version> is the macOS-idiomatic way to resolve a JDK path — worth knowing, since hardcoding the JDK path breaks on every Java update.
Summary table
| Platform | Method | Verdict / notes |
|---|---|---|
| Windows 10+ | WSL | ✅ Highly preferred — "much simpler setup that more closely matches the typical production environment" |
| Windows (older) | Native Java | ⚠️ May hit Windows-specific bugs that "may not get the attention" upstream. No path spaces. .bat files. One shell per process. |
| macOS | Homebrew | Simplest; pulls Java in automatically; links into /usr/local/{bin,etc,var} |
| macOS | Manual | "greater control over versions"; set JAVA_HOME via java_home -v |
| Any desktop OS | A VM matching production | ✅ The appendix's own top-level recommendation |
Appendix B — Additional Kafka Tools
"The Apache Kafka community has created a robust ecosystem of tools and platforms that make the task of running and using Kafka far easier."
CAVEAT EMPTOR
"While the authors are affiliated with some of the companies and projects that are included in this list, neither they nor O'Reilly specifically endorse one tool over others. Please be sure to DO YOUR OWN RESEARCH on the suitability of these platforms and tools for the work that you need to do."