How to install json gem - Failed to build gem native extension(mac 10.10) How to install json gem - Failed to build gem native extension(mac 10.10) xcode xcode

How to install json gem - Failed to build gem native extension(mac 10.10)


Sad, however, JSON-1.7.7 (and upto 1.8.1) is incompatible with Ruby-2.2.x. As you are using Ruby-2.2.1, it will not work for you.

There are 2 options for you:

  1. Update your json gem to 1.8.2 version. -- Preferable
  2. Edit ruby-2.2.1/ext/json/fbuffer/fbuffer.h file and replace problematic code with VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));. Look here for details


If you are using Ruby 2.2.0 or greater, the json gem will not compile properly. You can fix this by issuing bundle update json


I encountered this problem as well, and none of the suggested fixes here solved it.

I was only able to resolve it by manually re-downloading and re-installing the appropriate version of the Xcode command line tools:

https://developer.apple.com/download/more/?name=command%20line%20tools