1

I get the error when I try to install byebug. What's the reason for this?

sudo gem install byebug -v '10.0.1'
Building native extensions. This could take a while...
ERROR:  Error installing byebug:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/byebug-10.0.1/ext/byebug
/usr/bin/ruby2.3 -r ./siteconf20180326-12662-69j4pj.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/byebug-10.0.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86-linux/2.3.0/byebug-10.0.1/gem_make.out
Yuri Melo
  • 93
  • 1
  • 3
  • 12

1 Answers1

0

This error mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h is telling you it can't find the header file needed to build the gem.

Also, why are you installing with sudo ? What system are you on? Are you using a version manager rvm or rbenv ? I recommend https://rvm.io/rvm/install

Try to install with system libraries

gem install byebug -v '10.0.1' --use-system-libraries

If that doesn't work please run the following commands and post their output:

which ruby
ruby -v
gem -v
echo "${PATH//:/\n}" #may not work if your not on an *nix system

UPDATE:

Go to root of the project. Pick a ruby version but it looks like the ruby is pointing to a system ruby, not an rvm version. Try install a new ruby:

rvm install 2.4.1
rvm use 2.4.1
gem install byebug

If you have a Gemfile in your project and if it has ruby -v make sure it matches your version you set with rvm and add gem 'byebug' to your Gemfile then run

bundle install
lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • Hi there, I'm using Ubuntu. I get the error when I typed: gem install byebug -v '10.0.1' --use-system-libraries ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --use-system-libraries – Yuri Melo Mar 28 '18 at 01:43
  • which ruby -> /usr/bin/ruby ruby -v -> ruby 2.3.1p112 (2016-04-26) [i386-linux-gnu] gem -v -> 2.7.6 echo "${PATH//:/\n}" -> /usr/local/sbinn/usr/local/binn/usr/sbinn/usr/binn/sbinn/binn/usr/gamesn/usr/local/gamesn/snap/binn/home/yuri/.rvm/binn/home/yuri/.rvm/bin – Yuri Melo Mar 28 '18 at 01:47
  • rvm -v ---> rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] – Yuri Melo Mar 28 '18 at 01:48
  • What type of application? Is there a Gemfile in your project root? – lacostenycoder Mar 28 '18 at 01:51
  • 1
    It worked out now. Greats. I think that was some updating that I done yesterday – Yuri Melo Mar 28 '18 at 01:56
  • 1
    Thank you so much for helping! – Yuri Melo Mar 28 '18 at 01:58