Ruby – Compass cannot be installed on RedHat 7

Compass cannot be installed on RedHat 7… here is a solution to the problem.

Compass cannot be installed on RedHat 7

I’m trying to install compass on RedHat 7.

I installed ruby version ruby 2.0.0p598 (2014-11-13) [x86_64-linux].

I’m executing the following command:

sudo yum insatll ruby
sudo yum install gcc gcc-c++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
sudo gem install compass --http-proxy http://XXXXX:XXXX@XXXX:8080

I get the following error:

Build the native extension. This may take a while…
Error: Error installing compass:
Error: Unable to build gem native extension.

/usr/bin/ruby -r ./siteconf20150729-6603-73q6zu.rb extconf.rb

mkmf.rb could not find the ruby header file at /usr/share/include/ruby.h

extconf failed with exit code 1

The gem file remains in /usr/local/share/gems/gems/ffi-1.9.10 for inspection.
Results are logged to /usr/local/lib64/gems/ruby/ffi-1.9.10/gem_make.out

Not sure how to fix this. I even tried it before installing Compass

sudo gem update --system

Still the same bug. Then I tried updating ruby to 2.2.2 but still the same error. The gem version is 2.0.14

Solution

I believe you also need yum install ruby-devel to install ruby.h on your system. If that’s not enough, the bigger approach is to install the full “Development Tools” package:

yum groupinstall 'Development Tools'

Related Problems and Solutions