Search code examples
rubyjsonmacososx-elcapitan

gem install json issue with Mac OS X 10.11


I'm trying to install Ruby/JSON on Mac OS X 10.11. However, the gem install command gives the error message:

smcho@macho ruby-rails-sample> gem install json
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

    /Users/smcho/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151025-39148-au2m2x.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'

make "DESTDIR=" install
./install -m 0755 generator.bundle ./.gem.20151025-39148-i7g03f/json/ext
make: ./install: No such file or directory
make: *** [install-so] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/smcho/.rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /Users/smcho/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out

The message says make: ./install: No such file or directory, but I'm not sure how to fix this issue.

Is this a known issue, or is there a way to bypass this one?

This is my system version. I executed gem update --system to get the latest version.

> ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

> gem -v
2.4.8

Solution

  • I should have used the latest ruby (2.2.3) not the old one (2.2.1)

    ruby-rails-sample> rvm --default use 2.2.3
    Using /Users/smcho/.rvm/gems/ruby-2.2.3
    smcho@macho ruby-rails-sample> gem install json
    Building native extensions.  This could take a while...
    Successfully installed json-1.8.3
    Parsing documentation for json-1.8.3
    Installing ri documentation for json-1.8.3
    Done installing documentation for json after 1 seconds
    1 gem installed