DanMad DanMad - 10 months ago 468
Sass (Sass) Question

Installing Compass on Mac OS X 10.12 Sierra

I am working on two separate machines; one that has Compass installed on it from when the machine was running OS X Yosemite (happy with this one); and one that I am trying to install Compass on that is currently running OS X Sierra (Not so happy about this one).

I had some trouble back in the day with

gem install compass
while running Yosemite and after searching Stack it seemed that the issue was a user could no longer write to the specified directory they were trying to when running this command. Some suggested using running
sudo gem install compass
(and this is how I got my first machine running Compass).

With this second machine I run
sudo gem install compass
and received the following error:

Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.14 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.14/ext/ffi_c/gem_make.out

I am not very familiar with CLI. Why am I unable to install Compass on Mac OS X Sierra 10.12?

Answer Source

It looks like you missing the devel headers. I had a similar issue with another gem (ffi) and I solved it installing XCode (v. 8.0). Once downloaded make sure to open Xcode, some components are only installed after the first time you open it. After that try again to run gem install.