Nurdin
Nurdin

Reputation: 23893

Centos 7 -ERROR: Error installing rails: ERROR: Failed to build gem native extension

I got this error message when trying to install Rails on Centos 7

[root@xxxxx ~]# sudo gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb

Gem files will remain installed in /usr/local/share/gems/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/local/share/gems/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

Upvotes: 0

Views: 3916

Answers (1)

Loqman
Loqman

Reputation: 1580

The easiest way to get Nokogiri installed on CentOS and RHEL seems to be the EPEL repository which contains a prebuilt nokogiri package. To use it, install the appropriate epel-release package for your OS, then run:

sudo yum install -y rubygem-nokogiri

If you have issues, make sure you have some of the basic Ruby developer tools that you’ll need to compile the C extension, libxml2, and libxslt:

sudo yum install -y gcc ruby-devel zlib-devel

Upvotes: 1

Related Questions