Fix For Bundler Error On JSON Gem In Rails

03 Feb 2013

I was having an issue with new Rails installs, the ruby gems bundle install would abort when it tried to install json gem (Installing json (1.7.6) with native extensions) along with the following error message:

    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
    creating Makefile

    make
    sh: make: command not found


    Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.6 for inspection.
    Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
    An error occured while installing json (1.7.6), and Bundler cannot continue.
    Make sure that `gem install json -v '1.7.6'` succeeds before bundling.

The problem was that bundle install tries to download all new versions of gems, and since I already had json 1.7.6 installed, it threw an error when it got to that gem.

In order to exclude already installed gems, simply use

bundle install --local

This should let your install complete successfully.