Reputation: 3041
I trying to set up a development environment on a new machine. Ruby seems unhappy.
sudo npm install ruby -g
+ [email protected]
updated 1 package in 0.294s
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
sudo gem install sass
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.3.0/gems/ffi-1.11.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20190607-1543-ilb80e.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.11.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.11.1/gem_make.out
Yes I have already installed command line tools
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I have uninstalled and reinstalled ruby. What else can I try?
Upvotes: 0
Views: 502
Reputation: 211590
This NPM package you've installed called ruby
is not Ruby, but instead just something with the same name. It's not going to help with your Ruby problems. NPM is exclusively for Node.js.
To work with Ruby you'll want to install rbenv
. Follow the instructions closely for ensuring your Path is set up properly.
This gives you a lot more flexibility, but most importantly the Ruby development headers that are missing from the default macOS supplied Ruby.
Pure-Ruby packages will work without development headers, but anything that has compiled extensions, like Nokogiri or apparently Ruby SASS, will require them. In that case rbenv
has you covered.
Upvotes: 2