Install Confluent-Kafka on Apple's M1

1
2
3
4
5
git clone https://github.com/confluentinc/librdkafka.git
cd librdkafka
./configure --install-deps
make
sudo make install

if you get error like this:

1
cmp: TAGS: No such file or directory

you can try this:

1
2
3
4
5
brew install openssl zstd pkg-config
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
brew install ctags
export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"

after that, you can try again:

1
go run -tags dynamic main.go

if you get error like this:

1
2
3
4
5
Package libcrypto was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcrypto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libcrypto', required by 'rdkafka', not found
pkg-config: exit status 1

you can try this:

1
export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig