Rubocop: dyld: lazy symbol binding failed: Symbol not found: _rb_str_new_static

Created on 18 Dec 2015  路  4Comments  路  Source: rubocop-hq/rubocop

Often (unfortunately not always) when running rubocop in a directory, I get this error:

warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.7-compliant syntax, but you are running 2.1.6.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
dyld: lazy symbol binding failed: Symbol not found: _rb_str_new_static
  Referenced from: /Users/edwardloveall/.gem/ruby/2.2.3/gems/json-1.8.3/lib/json/ext/parser.bundle
  Expected in: flat namespace

dyld: Symbol not found: _rb_str_new_static
  Referenced from: /Users/edwardloveall/.gem/ruby/2.2.3/gems/json-1.8.3/lib/json/ext/parser.bundle
  Expected in: flat namespace

zsh: trace trap  rubocop

The compatibility warnings are new, but I've been seeing the dyld stuff for a while. What am I doing wrong here?

My ruby switcher is chruby version 0.3.9. I'm running rubocop v0.35.1. I'd give the full output of the rubocop -v but it gives me the same error.

Most helpful comment

Uninstall and reinstall the json gem.

Something is wrong with a C extension. Often, errors like this occur if an extension was compiled using headers from the wrong version of the Ruby interpreter.

All 4 comments

Uninstall and reinstall the json gem.

Something is wrong with a C extension. Often, errors like this occur if an extension was compiled using headers from the wrong version of the Ruby interpreter.

That worked, thanks! Hopefully it'll stick.

fwiw, uninstalling & reinstalling gems didn't work in Ruby 2.2.2 for me.

Switching to Ruby 2.3.0 did work. hth!

For those searching for a solution, this fixed it for me.

gem pristine json
bundle pristine json
Was this page helpful?
0 / 5 - 0 ratings