# How to install Apache Kafka on Mac with Homebrew

*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](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-mac).

## Installation overview

![Mac Kafka Homebrew install flow: install Homebrew, install Kafka, start ZooKeeper, start Kafka](https://www.conduktor.io/assets/kafka/diagrams/how-to-install-apache-kafka-on-mac-with-homebrew.svg)

```mermaid
flowchart LR
    A[Install Homebrew] --> B[Install Kafka]
    B --> C[Start ZooKeeper]
    C --> D[Start Kafka]
```

## Step 1: Install Homebrew

If you don't have Homebrew installed:

```bash
/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:

```bash
brew install kafka
```

## Installation paths

Homebrew installs to different locations based on your chip architecture:

| Component | Intel Mac | Apple 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:

```bash
/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:

```bash
/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](https://docs.conduktor.io/guide/conduktor-in-production/admin/configure-clusters) can connect to your local Kafka cluster at `localhost:9092` for visual topic management.

## Next steps

- [Install on Linux](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-linux) to set up Kafka on a Linux machine or server
- [CLI tutorials](https://www.conduktor.io/kafka/kafka-cli-tutorial) to create topics and produce messages
- [Native Mac installation](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-mac) for more control over versions
