Mac安装compass失败的原因

之前一直用的windows电脑,突然间切换成mac,各种不习惯,刚开始的时候连文件夹都找不到,悲催……

还好,熟悉了两天之后,基本上也能够操作了。

然后就是安装各种开发软件,由于个人习惯了使用sass开发css,所以使用命令行安装了sass,可是当安装compass的时候,悲剧发生了。

一直提示:

Building native extensions.  This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension. current directory: /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.17/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170302-3213-i36x9b.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.17 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/ffi-1.9.17/gem_make.out

然后就是各种求助,也搜索了很多解决方案,可是真的,没有完全解决。知道在知乎上看到一个答案

先xcode-select --install, 再sudo gem install compass, 然后compass -v 看到版本号,说明成功了,自 Xcode 5.0 开始,安装 Xcode 的命令行工具

然后就是命令行执行xcode-select --install,不幸的是,又提示安装xcode软件,没办法,只能安装软件咯!

漫长的下载时间,终于安装好之后,执行命令

Building native extensions.  This could take a while...
[[ASuccessfully installed ffi-1.9.17
Fetching: rb-inotify-0.9.8.gem (100%)
Successfully installed rb-inotify-0.9.8
Fetching: compass-1.0.3.gem (100%)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/compass

就是说依然安装失败,然后仔细看看这段报错提示, Operation not permitted - /usr/bin/compass  就是说/usr/bin/compass这个文件夹禁止操作,之前二次安装sass的时候,遇到过类似的提示,那就执行 sudo gem install -n /usr/local/bin compass

终于提示安装成功了。反复折腾当中,对这几个安装命令都比较熟练了。

  

上一篇:Android "Please ensure that adb is correctly located at" 错误


下一篇:Python初级面试语法<一>