Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Compass Basics Getting Started with Compass Installing Compass

Compass cannot be installed unless we have Mac Xcode?

Apparently Compass cannot be installed unless we have Mac Xcode? Ruby is installed and updated, but Compass won't install. The error message:

sh-3.2# gem install compass
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 -r ./siteconf20140930-4997-1sm2ezv.rb 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

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.5 for inspection.

6 Answers

Laura, check your xcode install and make sure it updated. I ran the command line install (xcode-select --install) and it ran for about 15 minutes or so. Afterwards, I kept running into the same issue as above when trying to install compass using the command line. I went to launch the xcode.app to check my version and it started updating. Went back and did the command line install of compass with no errors. Hope this works for you.

After making sure Xcode was up-to-date I ran the (xcode-select --install) command and then ran (gem install compass) successfully. Thanks Bruce!

Chris Shaw
Chris Shaw
26,676 Points

Hi Don,

You don't need Xcode per say but you do need xcode-select which Ruby uses to build extensions as it contains the gcc and g++ compilers, simply do the below and you should be good to go.

  1. Head over to the Apple Developer downloads site, you will need to log in using your Apple ID.

  2. Search for Command Line Tools, you will need a different download for earlier versions of OS X but for 10.9.x Command Line Tools (OS X 10.9) for Xcode - Xcode 6 is what you need, I would avoid the beta version as it may contain bugs.

  3. Once you have the dmg file downloaded run it and wait for the self installation to complete

  4. Close all your terminal windows if you have any open and then run gem install compass again, if you get an permission error run it as sudo

Hope that helps.

Hi Chris,

Thanks for the reply. Compass will still not install. Here is the info:

Running OS 10.9.5 Xcode 6.0.1 Sass 3.4.5 (Selective Steve) ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

Here is the error I am getting when trying to install Compass:

sh-3.2# gem install compass 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 -r ./siteconf20141001-6596-ugrnkn.rb 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

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.5 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/ffi-1.9.5/gem_make.out

Hoping someone can help with this. About to say nix to Compass and move on to something else.

Thanks, Don

Laura Hill
Laura Hill
13,674 Points

any luck with this? Same issue for me.

Laura Hill
Laura Hill
13,674 Points

Thanks Bruce. something similar solved the issue - I may never know what it was:) I had to keep starting over with each change. Up and running now. Thank you!

After making sure Xcode was up-to-date I ran the (xcode-select --install) command and then ran (gem install compass) successfully. Thanks Bruce!