bundle install does not install mysql2

Introduction

I get an error every time in my local environment so make a note of the solution

$ bundle install --path vendor/bundle 
...
Error statement ↓
An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.

Solution

$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
$ bundle install --path vendor/bundle

When the above command is executed, the following line will be added to .bundle / config

BUNDLE_BUILD__MYSQL2: "--with-ldflags=-L/usr/local/opt/openssl/lib"

Will come to be.

Recommended Posts

bundle install does not install mysql2
Bundle install with docker + rails6 does not reflect gem
mysql2 fails to install with bundle install
[Rails 6] MySQL 2 cannot be bundle install
bundle install error
MySQL container does not start in Docker
bundle install error
[Rails] Could not locate Gemfile with bundle install
Terminal does not start
Error when bundle install
How to install MySQL
Sidekiq-limit_fetch does not work
Suddenly bundle install is not possible due to gem'ffi'
After setting database to mysql, bundle install causes an error
bundle install failed (continued). The case caused by gem "MySQL2".
Ruby version does not switch
Difference between bundle and bundle install
What to do if mysql2 gets a bundle install error
WSL2 + Docker Desktop for Windows does not launch only MySQL container
Docker test DB does not start
Steps to install MySQL 8 on CentOS 8
"Selection does not include main type"
eclipse package org.springframework.boot.web.servlet.support does not exist
Error summary in bundle install. memorandum
Container does not start with docker-compose
[Docker] Does not connect to MySQL workbench ... DB container port forwarding settings
Copying the repository and getting a mysql2 error on the first bundle install