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

后端 未结 5 1701
深忆病人
深忆病人 2020-12-05 22:40

OS: Mac OS X 10.10.3 XCode: Latest with command line tools installed (version 6.3) Rails: version 4.2.1 Ruby: version 2.2.1

I was trying to generate the rou

相关标签:
5条回答
  • 2020-12-05 23:27

    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

    0 讨论(0)
  • 2020-12-05 23:34

    This worked for me, since I downloaded basic Ruby by accident.

    1.

    Install the Ruby "Development Kit" here: http://rubyinstaller.org/downloads/ Click the self-extracting file, and extract it here:

    C:\RubyDevKit

    (or somewhere else, but I had problems in other directories)

    2.

    Open the cmd (terminal): cd C:\RubyDevKit ruby dk.rb init ruby dk.rb install

    Source: http://jekyll-windows.juthilo.com/1-ruby-and-devkit/

    0 讨论(0)
  • 2020-12-05 23:37

    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

    0 讨论(0)
  • 2020-12-05 23:41

    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
    0 讨论(0)
  • 2020-12-05 23:45

    gem install json -v '1.8.2' worked for me.

    0 讨论(0)
提交回复
热议问题