Terminal error message when trying to install Sass

11,195

Solution 1

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 gem install sass

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 change active console page After run this command,write command of install sass again gem install sass gem install sass congratulation sass installed succussfully

Solution 2

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.

Solution 3

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

Solution 4

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.

Share:
11,195
Shivang Patel
Author by

Shivang Patel

Updated on June 22, 2022

Comments

  • Shivang Patel
    Shivang Patel almost 2 years

    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?