Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Can't install Testapp (Ubuntu 14.04) | json 1.8.2 problem

I'm stuck here:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20150405-27483-1v0hhhq/json-1.8.2/gems/json-1.8.2 for inspection. Results logged to /tmp/bundler20150405-27483-1v0hhhq/json-1.8.2/extensions/x86_64-linux/2.1.0/json-1.8.2/gem_make.out An error occurred while installing json (1.8.2), and Bundler cannot continue. Make sure that gem install json -v '1.8.2' succeeds before bundling.

I've tried to install son -v '1.8.2 but it just won't work. Any help?

3 Answers

Devin Scheu
Devin Scheu
66,189 Points

Maybe because you wrote son, not json?

uups, well spotted. But I've typed that wrong here, bus correct on the console.

This is what the result looks like:

max@max-ThinkPad-T400:~/projects$ sudo gem install json -v '1.8.2' Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/json-1.8.2 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/json-1.8.2/gem_make.out

Worked after doing this: in my case (Ubuntu 14.04) that didn't work directly and I had to do this:

$ sudo apt-get install ruby-dev

and then I could install the gem and continue. Had one more problem that was fixed by:

$ sudo apt-get install libsqlite3-dev

Hope that helps anyone who encounters the same problem.