[Ruby FAQs - mysql2] gem install mysql2
gem install mysql2
ld: library not found for -lssl
There may encountered the following error when installing the mysql2
gem on macOS:
1 | gem install mysql2 # or bundle |
-
- Make sure
openssl
is installed on Mac via Homebrew.
- Make sure
1 | brew install openssl |
-
- Install
mysql2
gem.
- Install
1 | gem install mysql2 -v '0.5.3' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include |
See Cannot install mysql2 gem for Rails project - Stack Overflow - https://stackoverflow.com/questions/43523389/cannot-install-mysql2-gem-for-rails-project to learn more.
References
[2] mysql2 | RubyGems.org | your community gem host - https://rubygems.org/gems/mysql2/
[3] RubyGems.org | your community gem host - https://rubygems.org/
[4] MySQL - https://www.mysql.com/
[5] /source/index.html - https://www.openssl.org/
[6] [openssl@3 — Homebrew Formulae - https://formulae.brew.sh/formula/openssl@3]
[7] The Missing Package Manager for macOS (or Linux) — Homebrew - https://brew.sh/