How to install Apache Kafka on Mac with Homebrew

Install Kafka on Mac with Homebrew. Run brew install kafka, manage ZooKeeper and the broker as background services, and verify the setup with the CLI.

Install and run Kafka on macOS with Homebrew

Homebrew provides a quick way to install Kafka on macOS. It handles Java dependencies automatically and places binaries in your PATH.

What you'll learn:

  • How to install Kafka using Homebrew
  • How to start ZooKeeper and Kafka
  • How to locate configuration files
  • Differences between Intel and Apple Silicon paths

Homebrew vs native installation

Homebrew is convenient but provides less control over versions. For development with specific Kafka versions, consider the native Mac installation.

Installation overview

Mac Kafka Homebrew install flow: install Homebrew, install Kafka, start ZooKeeper, start Kafka

Step 1: Install Homebrew

If you don't have Homebrew installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Install Kafka

Homebrew automatically installs Java as a dependency:

brew install kafka

Installation paths

Homebrew installs to different locations based on your chip architecture:

ComponentIntel MacApple Silicon Mac
Binaries/usr/local/bin/opt/homebrew/bin
Kafka config/usr/local/etc/kafka/opt/homebrew/etc/kafka
ZooKeeper config/usr/local/etc/zookeeper/opt/homebrew/etc/zookeeper
Kafka data/usr/local/var/lib/kafka-logs/opt/homebrew/var/lib/kafka-logs

Apple Silicon users

Replace /usr/local/ with /opt/homebrew/ in all commands below if you have an M1, M2, or M3 Mac.

Step 3: Start ZooKeeper

ZooKeeper has to be running before Kafka starts:

/usr/local/bin/zookeeper-server-start /usr/local/etc/zookeeper/zoo.cfg

Keep this terminal window open.

Step 4: Start Kafka

Open a new terminal window and start Kafka:

/usr/local/bin/kafka-server-start /usr/local/etc/kafka/server.properties

Keep this terminal window open. Kafka is now running at localhost:9092.

Optional: Change data directories

Change ZooKeeper data directory:

Edit /usr/local/etc/zookeeper/zoo.cfg:

dataDir=/your/path/to/data/zookeeper

Change Kafka data directory:

Edit /usr/local/etc/kafka/server.properties:

log.dirs=/your/path/to/data/kafka

See it in practice with Conduktor

Conduktor Console can connect to your local Kafka cluster at localhost:9092 for visual topic management.

Next steps