【Unity】「Failed to install CocoaPods for the current user.」の解決方法

エラー内容

Unityをビルドしようとしたら以下のエラーが出た。

Failed to install CocoaPods for the current user.
It will not be possible to install Cocoapods in the generated Xcode project which will result in link errors when building your application.
For more information see:
  https://guides.cocoapods.org/using/getting-started.html
'gem install activesupport -v 4.2.6 --user-install' failed with code (1):
Building native extensions. This could take a while...
WARNING:  You don't have /Users/consolesoup/.gem/ruby/2.6.0/bin in your PATH,
	  gem executables will not run.
ERROR:  Error installing activesupport:
	ERROR: Failed to build gem native extension.
    current directory: /Users/consolesoup/.gem/ruby/2.6.0/gems/json-1.8.6/ext/json/ext/generator
/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 ./siteconf20210227-10062-1o2ue8a.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /Users/consolesoup/.gem/ruby/2.6.0/gems/json-1.8.6 for inspection.
Results logged to /Users/consolesoup/.gem/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/json-1.8.6/gem_make.out
UnityEngine.Debug:LogError (object)
Google.Logger:Log (string,Google.LogLevel) (at Z:/tmp/tmp.GpfXWvqsmd/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:136)
Google.IOSResolver:Log (string,bool,Google.LogLevel) (at Z:/tmp/tmp.sDid0DMama/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:1032)
Google.IOSResolver/<InstallCocoapods>c__AnonStorey2:<>m__0 (int,Google.IOSResolver/CommandItem[],GooglePlayServices.CommandLine/Result,GooglePlayServices.CommandLineDialog) (at Z:/tmp/tmp.sDid0DMama/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:1563)
Google.IOSResolver:RunCommandsAsync (Google.IOSResolver/CommandItem[],Google.IOSResolver/CommandItemCompletionHandler,bool,string) (at Z:/tmp/tmp.sDid0DMama/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:2178)
Google.IOSResolver:InstallCocoapods (bool,string,bool) (at Z:/tmp/tmp.sDid0DMama/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:1553)
Google.IOSResolver:OnPostProcessEnsurePodsInstallation (UnityEditor.BuildTarget,string) (at Z:/tmp/tmp.sDid0DMama/third_party/unity/unity_jar_resolver/source/IOSResolver/src/IOSResolver.cs:1651)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)

解決方法

CocoaPodsがinstallされていないのが原因です。

CocoaPodsのインストール

2021/02/27

インストール後にビルドして、ビルドが終わらない場合、
書き出し先のXcodeプロジェクトを一度削除して再度ビルドしてください。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です