Fixing ‘gem install rails’

While trying to install Ruby on Rails in Fedora Core 19, I ran into some errors with the ‘gem install rails’ command.

[mark@localhost ~]$ gem install rails
Fetching: i18n-0.6.9.gem (100%)
Successfully installed i18n-0.6.9
Fetching: multi_json-1.8.2.gem (100%)
Successfully installed
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: minitest-4.7.5.gem (100%)
Successfully installed minitest-4.7.5
Fetching: atomic-1.1.14.gem (100%)
Building native extensions.  This could
take a while...
ERROR:  Error installing rails:
	ERROR: Failed to build gem native extension.
    /usr/bin/ruby extconf.rb

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

Gem files will remain installed in
/home/mark/.gem/ruby/gems/atomic-1.1.14 for inspection.

Results logged to

The fix to this error was to install the development files for ruby using ‘yum install ruby-devel’ which installs the header files. This may or may not help in all situations, but I have found that missing header file errors can be fixed by installing the devel package.



Leave a Reply