How do I resolve "incompatible library version" for mysql2 gem with ruby 2.3 on OS X? How do I resolve "incompatible library version" for mysql2 gem with ruby 2.3 on OS X? ruby ruby

How do I resolve "incompatible library version" for mysql2 gem with ruby 2.3 on OS X?


I ended up solving this with gem pristine --all


I have solved this with gem pristine mysql2 followed by spring stop.


I experienced the same issue. I had ruby 2.3.4 installed and using rails 4.6.2.

There were two issues causes and the support team of the hosting company I was using helped me resolve the issue.

The first was that the mysql2 lib that was installed was, by default, linked to ruby 1.8 instead of ruby 2

# lld ../2.2.0/mysql2-0.4.4/mysql2/mysql2.so... ...libruby.so.1.8 => /usr/lib64/libruby.so.1.8 (0x00007f2af1f8a000)...

Second issue was to compile the lib with the installed mysql server config

So mysql2 gem had to be uninstalled and re-installed with the right ruby lib and compiled with the right mysql config.

Below are the commands.

gem uninstall mysql2gem install mysql2 -- --with-mysql-config=/usr/bin/mysql_config --with-opt-lib=/where/my/ruby22/lib_was_located/