Mojaveでcocoapodsをアップデートしようとしたら以下のようなログが出てアップデートできませんでした。
sudo gem install cocoapodsが失敗する...
```text
`gutter:false;
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0/specifications/nokogiri-1.5.6.gemspec:22.
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.3.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20200929-627-1189suj.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.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/gem_make.out
```
最近のXcodeをインストールすると、ruby2.3のヘッダーファイルが無いみたいでそれが原因見たいです。
以下の方法で解消できます。
```bash
`gutter:false;
$ curl -L https://get.rvm.io | bash -s stable
$ rvm install ruby-2.6
$ rvm use ruby-2.6.5
$ rvm --default use 2.6.5
```
rubyのバージョンはコマンド実行時のログを見て柔軟に変えてください。
## 参考URL
- [原因](https://support.circleci.com/hc/en-us/articles/360035866534-Since-switching-to-Xcode-11-you-receive-Failed-to-build-gem-native-extension-)
- [解決方法](https://github.com/CocoaPods/CocoaPods/issues/9538)
0 件のコメント :
コメントを投稿