Technology Insights

Install Ruby JSON Gem on Windows

When attempting to install the Ruby JSON gem on Windows you are most likely going to get an error similar to the below. The trick is to instead install json_pure gem using the syntax listed below the error.

Error:

bash

  1. C:\>gem install json
  2. Building native extensions. This could take a while...
  3. ERROR: Error installing json:
  4. ERROR: Failed to build gem native extension.
  5.  
  6. C:/ruby/bin/ruby.exe extconf.rb install json
  7. creating Makefile
  8.  
  9. nmake
  10. 'nmake' is not recognized as an internal or external command, operable program or batch file.
  11.  
  12. Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3 for inspection.
  13. Results logged to C:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser/gem_make.out

Technology Errors

‘nmake’ is not recognized as an internal or external command, operable program or batch file

This means nmake is not installed on your Windows PC. To install you need to downloading, extract, and place two files into your $PATH. Follow the couple steps below to install nmake on your PC. In my case I installed nmake on Windows XP.

  1. Download nmake: Visit the following link to download nmake.
  2. Extract nmake:Run the Nmake15.exe file which will extract two files to the directory where it is located. These files will be nmake.exe and NMAKE.ERR.