我试图在新机器上设置开发环境。露比似乎不开心。
sudo npm install ruby -g
+ ruby@0.6.1
updated 1 package in 0.294s
红宝石-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
是,我已经安装了命令行工具
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
我已经卸载并重新安装了ruby。我还能尝试什么?
答案 0 :(得分:2)
This NPM package you've installed called ruby
不是 Ruby ,而是名称相同的东西。它不会帮助您解决Ruby问题。 NPM专用于Node.js。
要使用Ruby,您需要安装rbenv
。严格按照说明进行操作,以确保正确设置您的路径。
这为您提供了更大的灵活性,但最重要的是,默认macOS提供的Ruby中缺少Ruby开发标头。
Pure-Ruby软件包无需开发头即可使用,但是任何已编译扩展的内容(如Nokogiri或Ruby SASS)都将需要它们。在这种情况下,rbenv
可以帮助您解决问题。