DEV Community

Cover image for Data streaming on MacOS: the easy way
The Team @ Redpanda for Redpanda Data

Posted on • Originally published at

Data streaming on MacOS: the easy way

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 streaming 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
Enter fullscreen mode Exit fullscreen mode

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:

install redpanda and rpk

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"
Enter fullscreen mode Exit fullscreen mode

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:

3 node redpanda cluster

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>
Enter fullscreen mode Exit fullscreen mode


create a redpanda topic

Produce to your topic using:

rpk topic produce topic_name --brokers <broker_1><broker_2><broker_3>
Enter fullscreen mode Exit fullscreen mode

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.


Produce message

To consume from the topic, run:

rpk topic consume topic_name --brokers <broker_1><broker_2><broker_3>
Enter fullscreen mode Exit fullscreen mode

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

consuming from redpanda

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 always find our rpk command documentation here, and our full, source-available GitHub repository here.

Top comments (0)