This is what I get:
➜ ~ gem install alfi
Building native extensions. This could take a while...
ERROR: Error installing alfi:
ERROR: Failed to build gem native extension.
current directory: /Users/dino/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/Users/dino/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170110-22634-1h2aq5u.rb extconf.rb
creating Makefile
current directory: /Users/dino/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Users/dino/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c:861:25: error: use of undeclared identifier 'rb_cFixnum'
} else if (klass == rb_cFixnum) {
^
generator.c:863:25: error: use of undeclared identifier 'rb_cBignum'
} else if (klass == rb_cBignum) {
^
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2163:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs+1, varc, vari+1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2168:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs+1, varc, vari+1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
rb_scan_args(argc, argv, "01", &opts);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
rb_scan_args0(argc,argvp,fmt,\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
rb_scan_args_verify(fmt, varc), vars)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
verify = rb_scan_args_verify_count(fmt, varc); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro 'rb_scan_args_count_hash'
rb_scan_args_count_block(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dino/.rbenv/versions/2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings and 2 errors generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/dino/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /Users/dino/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0-static/json-1.8.3/gem_make.out
Maybe you just need to bump the version of the json
gem you are using?