Skip to content

Instantly share code, notes, and snippets.

@jarrad
Last active August 24, 2023 08:23
Show Gist options
  • Star 69 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save jarrad/3528a5d9128fe693ca84 to your computer and use it in GitHub Desktop.
Save jarrad/3528a5d9128fe693ca84 to your computer and use it in GitHub Desktop.
Install Kafka on OSX via Homebrew
$> brew cask install java
$> brew install kafka
$> vim ~/bin/kafka
# ~/bin/kafka
#!/bin/bash
zkServer start
kafka-server-start.sh /usr/local/etc/kafka/server.properties
$> chmod +x ~/bin/kafka
@kbrock
Copy link

kbrock commented Apr 10, 2023

If you want to use kraft instead of zookeeper, just replace the default server.properties with the default kraft server.properties.

You can use /usr/local/ instead of $(brew --prefix) if you prefer.

brew install kafka

mv $(brew --prefix)/etc/kafka/kraft/server.properties $(brew --prefix)/etc/kafka/server.properties
kafka-storage format -t $(kafka-storage random-uuid) -c $(brew --prefix)/etc/kafka/server.properties

Then the zookeeper command is not necessary:

brew services start kafka
brew services info kafka
brew services stop kafka

@spartiv -- the info is for showing the status


After installing java (via kafka) I told OSX to use the java that I installed: (not sure if this is necessary)

sudo ln -sfn $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment