Edited at

Ubuntu 16.04 で mkmf.rb can't find header files が発生する

More than 1 year has passed since last update.

こちらの記事 の Ubuntu 版です。

debug_inspector をインストールしようとすると mkmf.rb can't find header files for ruby が出ました。

% sudo gem install debug_inspector -v '0.0.2'

Fetching: debug_inspector-0.0.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing debug_inspector:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
/usr/bin/ruby2.3 -r ./siteconf20171005-19309-25akqd.rb 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.3.0/gems/debug_inspector-0.0.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.2/gem_make.out

ruby-dev をインストールすると解決します。

% sudo apt-get install ruby-dev

% sudo gem install debug_inspector -v '0.0.2'