出现场景
最新换了个512的大硬盘,重装了MacOS 10.15,安装Cocoapods时,出现以下错误
Building native extensions. This could take a while... ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension. current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/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 ./siteconf20210324-1667-1wwdce5.rb extconf.rb checking for ffi.h... no checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes checking for ffi_prep_closure_loc() in -lffi... yes checking for ffi_prep_cif_var()... yes checking for ffi_raw_call()... yes checking for ffi_prep_raw_closure()... yes creating extconf.h creating Makefile current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c make "DESTDIR=" clean current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c make "DESTDIR=" make: *** No rule to make target `"/Volumes/macOS', needed by `AbstractMemory.o'. Stop. make failed, exit code 2 Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0 for inspection. Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.0/gem_make.out
解决方法
- 可能是系统版本问题,不兼容最新版本,所以直接安装老版本。笔者碰到问题时是2021.07.06,当前最新版本是1.10.1,找一个1.9.3,2020.05发布的,应该兼容10.15。
# 指定版本安装 sudo gem install -n /usr/local/bin cocoapods -v 1.9.3
- 使用brew来安装
brew install cocoapods