The Mac M1 family has been presented more than two year ago and I still encounter a new issue every time I try to install the mysql2 Ruby gem.
But... I think I've finally found a set of commands to fix all these issues!
First of all, install the required dependencies:
brew install gcc zstd openssl mysql
now export all the libraries paths which we need to build the gem:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
aaaand now install the mysql gem:
gem install mysql2 -v '0.5.4' -- --with-opt-dir=$(brew --prefix openssl) --with-ldflags=-L$(brew --prefix zstd)
woila', I'm 100% this will succed, if don't please leave a comment so we can figure out a new solution to help who will read this post 🚀