Reputation: 177
Below is the exact message returned from terminal:
ERROR: Error installing sass: ERROR failed to build gem native extension. current directory: /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.18/ext/ffi_c /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170721-3751-3vsh43.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.18 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/ffi-1.9.18/gem_make.out
I tried both options, including gem install sass
and sudo gem install sass
. @Carnaru Valentin said to try sudo apt-get install ruby2.1-dev build-essential
. When I tried this, terminal returned sudo: apt-get: command not found
. I am running macOS. Anyone know how to solve this issue?
Upvotes: 6
Views: 11470
Reputation: 2997
First
you should download the last version of Ruby Ruby Last Version because rubygems.org updated their SSL certificate and older versions don't have the updated certificate bundled for more information about this check this link
rubygem SSL certificate
Second
after you install last version of Ruby , open cmd and write this command gem install sass
if you have an error like this
You must run this command chcp 65001
chcp is shortcut for Change the active console This command is rarely required as most GUI programs and PowerShell now support Unicode for more information check this link
After run this command,write command of install sass again gem install sass
Congratulation sass installed succussfully
Upvotes: 2
Reputation: 6494
If you installed ruby from distro`s repo the problem might occur because you didn't install development libraries (ruby.h in particular)
sudo apt-get install ruby-dev
or
sudo dnf install ruby-devel
Upvotes: 2
Reputation: 91
Don’t use the Ruby 2.5.0 installer, unless you want to solve issues when installing gems! If you don’t know what version to install and you’re getting started with Ruby, Ruby recommend you use Ruby 2.4.X as x64 or x86 installer. These provide a stable language and the biggest number of compatible gems. However, not all gems are maintained. Some older packages may not be compatible with newer versions of Ruby and RubyInstaller.
Ensure the "Add Ruby executables to your PATH" is enabled during the installation process. Then try and type in gem install sass. hope this helped someone.
Upvotes: 1
Reputation: 8152
It happens because you don't have Xcode Command Line developer tool on your OSX. For Sass, Compass and NPM, you need to have Xcode on your Mac OSX.
Install it by this command: xcode-select --install
. You can also install it through App Store. It usually takes time to download and Install Xcode.
After installation is finished you must use sudo xcodebuild -license
command to accept Xcode License agreement. Once you accept it, you can install your Sass with sudo gem install sass
command easily.
Upvotes: 16