How to install Kafka on macOS

Apache Kafka is a distributed streaming platform used for building real-time data pipelines and streaming applications. In this tutorial, you will learn how to install Kafka on macOS.

Prerequisites

Before you start, ensure that you have the following prerequisites:

Step 1: Download Apache Kafka

Go to the Apache Kafka website at http://kafka.apache.org/downloads and download the latest stable version of Kafka.

Step 2: Extract the downloaded archive

In the Terminal, navigate to the directory where the Kafka archive was downloaded and extract it using the following command:

tar -xzf kafka_<version>.tgz

Replace <version> with the version of Kafka you downloaded, for example:

tar -xzf kafka_2.13-2.8.0.tgz

This will extract the Kafka files to a directory with the same name as the archive file.

Step 3: Start the ZooKeeper server

Kafka uses ZooKeeper to manage its cluster metadata. Start the ZooKeeper server by running the following command:

bin/zookeeper-server-start.sh config/zookeeper.properties

This will start the ZooKeeper server on the default port, 2181.

Step 4: Start the Kafka broker

To start the Kafka broker, run the following command:

bin/kafka-server-start.sh config/server.properties

This will start the Kafka broker on the default port, 9092.

Step 5: Verify that Kafka is running

To verify that Kafka is running, open a new Terminal window and run the following command:

bin/kafka-topics.sh --list --bootstrap-server localhost:9092

This will list all the available topics on your Kafka cluster. If you see an output similar to the following, Kafka is successfully installed and running:

__consumer_offsets

Conclusion

Congratulations! You have successfully installed Apache Kafka on your macOS system. You can now use Kafka to develop real-time data pipelines and streaming applications.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!