This is the fastest way to get up and running with Redpanda on your Mac and be API-compatible with Apache Kafka.

ByRob BlaffordKayla MinguezonApril 19, 2022
Kafka-compatible event streaming on macOS in less than one minute

Introduction

Redpanda makes it easy to create a streaming data environment, while also keeping you API-compatible with Apache Kafka®. If you’re one of the many developers who already have Homebrew and Docker Desktop installed on your Mac, you can get up and running with Redpanda very quickly. In this post, we’ll show you how to install Redpanda and its command line interface, rpk, in one minute or less.

If you prefer to use Kubernetes, you can find more information about K8s options for Redpanda here. For Linux, kind and minikube are the simplest ways to get running with Redpanda.

The single fastest way to start using Redpanda on macOS

Most developers who use Mac already have Homebrew and Docker Desktop installed. In this case, you only need a single line of code to start using Redpanda:

brew install redpanda-data/tap/redpanda && rpk container start

This single command line will install both Redpanda, as well as its CLI, which is called rpk. When you paste the above command into your terminal, you’ll see something like this:

Set up

Redpanda and rpk have been installed successfully, and you’ve created your first, single-node cluster! It’s that easy.

You can now use rpk to interact with the node. But, first, here’s how you can get to this point if you don’t already have Docker and Homebrew installed on your machine

If you don’t have Docker or Homebrew installed

If you don’t already have Docker Desktop and Homebrew on your machine, don’t worry. It’s still very easy to install these tools and start using Redpanda. Here’s how to get set up with these prerequisites:

1. Install Docker Desktop

To install Docker on your Mac, go to this page and select the architecture-appropriate version of Docker Desktop to download for your machine.

Note that your macOS must be V10.15 or newer (Catalina, Big Sur, or Monterey versions) in order to run Docker.

2. Install Homebrew

Install Homebrew by copy the following script into your macOS terminal:

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

With these prerequisites installed, you can now use the single command line above to start using Redpanda on your machine.

Have some fun with Redpanda and rpk

Now that you have a one-node cluster up and running, you can use our list of rpk commands to experiment and interact with Redpanda.

Setting up a three-node cluster

To prepare your environment to start a new cluster, first purge your existing single-node cluster using rpk container purge.

Now you can use rpk container start -n 3 to start a new, three-node cluster.

You will see something like this:

Three nodes

Be sure to note the brokers listed in this output. You will need them to run commands in rpk.

You can now further interact with the cluster. Use rpk to create a topic:

rpk topic create topic_name --brokers <broker_1><broker_2><broker_3>

Example:

Create topic

Produce to your topic using:

rpk topic produce topic_name --brokers <broker_1><broker_2><broker_3>

Type a test message you want produced to your topic. For example:

hello world!

If the message was produced correctly, you’ll get a message similar to the following:

Produced to partition 0 at offset 0 with timestamp 1646948687487.

Example:

Produce message

To consume from the topic, run:

rpk topic consume topic_name --brokers <broker_1><broker_2><broker_3>

If the message was consumed correctly, you’ll get an output similar to this:

Consume message

Congratulations! You just did your first bit of data streaming on Redpanda.

Follow the rpk command documentation for more commands you can use.

When you’re done working within your node or cluster, shut it down and delete the node(s) using rpk container purge. This will clean up your streaming data environment.

Take the next step!

If you have any questions getting started with Redpanda and rpk, please join our community Slack. You can also find our rpk command documentation here, and our full, source-available GitHub repository here.

Let's keep in touch

Subscribe and never miss another blog post, announcement, or community event. We hate spam and will never sell your contact information.