0

I am trying to install Sass using sudo gem install sass on my Mac terminal. It gives me this error:

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

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20210118-51317-14a8oi4.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib
    --enable-system-libffi
    --disable-system-libffi
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'

For reference, my operating system is macOS Catalina version 10.15.7 and I have ruby 2.6.3p62. I have tried sudo apt install ruby-dev before trying to again, and it gives me this message:

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/apt" (-1). 

I have also tried installing with brew and I already have command line tools installed. What should I do?

Alter Lagos
  • 12,090
  • 1
  • 70
  • 92
  • The log you mentioned says `You have to install development tools first.` Have you tried this? [Gem installation error: You have to install development tools first](https://stackoverflow.com/questions/27768420/gem-installation-error-you-have-to-install-development-tools-first) – Alter Lagos Jan 19 '21 at 02:13
  • Why are you using `sudo`? You should not have to use `sudo` to install gems. It will just cause issues later on. – Beartech Jan 19 '21 at 06:42
  • I have installed development tools per the instructions in the question, retried installing sass, and it gave me the same error that prompted me to ask this question. And I have tried the other standard way of installing sass, gem install sass, and it gave me this error in my terminal: ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/CHANGELOG.md macbooks-MacBook-Pro:~ macbookpro$ – Fabiola Pina Jan 20 '21 at 01:38
  • I also just tried installing sass globally using npm and it gave me this error: The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user. – Fabiola Pina Jan 20 '21 at 01:45
  • I finally figured out how to do it. I had to install it using npm i sass. I was using a different version of npm install and this one seemed to work for some reason. – Fabiola Pina Jan 20 '21 at 01:57

0 Answers0