Recibí el mismo error al intentar instalar mysql2 -v 0.4.1 en M1
--SOLUCIONADO--
brew install zstd
which zstd
mi ruta es -> /opt/homebrew/bin/zstd
necesitas verificar desde dónde se vinculó zstd
cd /opt/homebrew/bin
ls -la
zstd -> ../Cellar/zstd/1.5.0/bin/zstd
entonces necesita obtener la ruta a zstd lib, mi es:
/opt/homebrew/Cellar/zstd/1.5.0/lib
Y luego haz una combinación clásica con algo de magia
bundle config --local build.mysql2 "--with-ldflags=-L/opt/homebrew/Cellar/zstd/1.5.0/lib"
bundle install
gem list my
*** LOCAL GEMS ***
mysql2 (0.4.10)