A few days ago I did a Mac OS Sierra 10.12.6 Security Update 2018-005. Yesterday I ran grunt and got a:
Warning: Running "sass:dist" (sass) task
Warning: spawn sass ENOENT Use --force to continue.
Aborted due to warnings.
I followed the instructions here: https://github.com/appseed-io/supermodular/issues/45
xcode-select --install
sudo gem update --system
sudo gem install -n /usr/local/bin compass
I was still getting grunt errors:
Running "sass:build" (sass) task
ERROR: Cannot load compass.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
I then followed the instruction here: https://halfelf.org/2017/grunt-cant-build-sass-on-high-sierra/
brew install rbenv ruby-build
rbenv install 2.4.2
rbenv global 2.4.2
sudo gem update --system
sudo gem install -n /usr/local/bin sass
Still getting the grunt ERROR: Cannot load compass.
Then tried sudo gem install -n /usr/local/bin compass
again, but get the following error:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
I checked the mkmf.log file which says:
"pkg-config --exists libffi"
package configuration for libffi is not found
"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -iwithsysroot /usr/local/libressl/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/lib -arch x86_64 -arch i386 -lruby.2.3.0 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
What I take from that (not really knowing) is that package configuration for libffi is not found
and fatal error: 'ruby/config.h' file not found
.
Additional info:
Xcode Version 9.2 (9C40b)
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin16]
sass -v
Sass 3.4.25 (Selective Steve)
compass -v
-bash: /usr/local/bin/compass:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Thanks in advance.
UPDATE
I ran gem env
. This is the output:
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.8
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/username/.nvm/versions/node/v8.4.0/bin
- /Users/username/.wp-cli/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Don't do sudo gem install -n /usr/local/bin compass
The whole point of using rbenv
is to let it handle all of your dependencies and not have to deal at all with your OS system ruby or it's gems. You need to get your $PATH
configuration right and then you won't need to ever use sudo
in fact you should NOT with gem install
or any gem
commands after getting your environment setup correctly.
Did you happen to try npm install -g grunt-cli
?
UPDATE: as expect your $PATH is not correct.
Close all terminals. Start a new one. Then run this.
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
This should help you figure out what's wrong in your $PATH
setting.
Refer to https://github.com/rbenv/rbenv#installation
But first specifically try:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
Then restart your terminal and check gem env
again and see if your path includes .rbenv
If these steps don't get you working then I suggest to fully uninstall rbenv and start over from step 1 of https://github.com/rbenv/rbenv#installation