Skip to content

Instantly share code, notes, and snippets.

@roolo
Last active December 25, 2018 07:43
Show Gist options
  • Save roolo/5006111 to your computer and use it in GitHub Desktop.
Save roolo/5006111 to your computer and use it in GitHub Desktop.
Fixing "Incorrect MySQL client library version! This gem was compiled for 5.5.29 but the client library is 5.6.10. (RuntimeError)" on OS X while using Brew
ARCHFLAGS="-arch x86_64" gem install mysql2 -- –with-mysql-config=/usr/local/bin/mysql_config
@firecall
Copy link

+1

@Sparkboxx
Copy link

Thanks!

@msupko
Copy link

msupko commented Dec 4, 2013

The above did not work for me without adding env. I had to use:

env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config

@casoetan
Copy link

@msupko worked for me too.

@vinchi777
Copy link

thanks

@jayrmotta
Copy link

This is sad :(

[jayrmotta] ~/zup-codes/cockpit/cockpit-api ruby-2.1.2 (master) $ ~/Downloads/mysql2-gem-install.sh
Building native extensions with: '-with-mysql-config=/usr/local/bin/mysql_config'
This could take a while...
Successfully installed mysql2-0.3.17
Parsing documentation for mysql2-0.3.17
Done installing documentation for mysql2 after 1 seconds
1 gem installed


[jayrmotta] ~/zup-codes/cockpit/cockpit-api ruby-2.1.2 (master) $ bundle exec rspec
/Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/mysql2-0.3.17/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.28 but the client library is 5.6.20. (RuntimeError)
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/mysql2-0.3.17/lib/mysql2.rb:8:in `<top (required)>'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/config/application.rb:14:in `<top (required)>'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/config/environment.rb:2:in `require'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/config/environment.rb:2:in `<top (required)>'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/spec/rails_helper.rb:5:in `require'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/spec/rails_helper.rb:5:in `<top (required)>'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/spec/helpers/events_transformer_spec.rb:1:in `require'
    from /Users/jayrmotta/Documents/codes/zup/cockpit/cockpit-api/spec/helpers/events_transformer_spec.rb:1:in `<top (required)>'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `each'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in `setup'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.1.7/exe/rspec:4:in `<top (required)>'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/bin/rspec:23:in `load'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/bin/rspec:23:in `<main>'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
    from /Users/jayrmotta/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

@ezmiller
Copy link

I'm getting this version of this error, and neither of the suggestions above helped, sadly:

Incorrect MySQL client library version! This gem was compiled for 5.5.27 but the client library is 5.6.22.

@ilyaruby
Copy link

ilyaruby commented Feb 3, 2016

There is an error in this gist.

Here, use "--with-mysql-config" instead of "–with-mysql-config" (note two short dashes instead of a long one).

If this fails to update a mysql2 then one could just use an another RVM ruby version or a new separate RVM gemset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment