Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Unity Services error - Failed to install CocoaPods for the current user

Discussion in 'Editor & General Support' started by AndrewAtCandlelight, Apr 11, 2023.

  1. AndrewAtCandlelight

    AndrewAtCandlelight

    Joined:
    May 3, 2022
    Posts:
    7
    Hello all!

    I have been running into an issue consistently for weeks and it is effectively stopping forward progress on my project - help would be hugely appreciated!

    It occurs when adding Unity Services packages to any project (most recent was a project built with 2021.3.21f1 running on an M1 Mac, MacOS 12.6.3)

    I can reproduce the error by running a clean version of the unity services sample project here

    cocoapods was installed with homebrew

    pod --version
    1.12.0

    gem --version
    3.0.3.1​

    The error occurs with the iOS resolver.

    error in the editor console:
    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 cocoapods --user-install' failed with code (1):
    Building native extensions. This could take a while...

    WARNING: You don't have /Users/username/.gem/ruby/2.6.0/bin in your PATH,
    gem executables will not run.

    ERROR: While executing gem ... (Errno::EACCES)
    Permission denied @ dir_s_mkdir - /Users/username/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5

    UnityEngine.Debug:LogError (object)
    Google.Logger:Log (string,Google.LogLevel)
    Google.IOSResolver:Log (string,bool,Google.LogLevel)
    Google.IOSResolver:LogToDialog (string,bool,Google.LogLevel)
    Google.IOSResolver/<InstallCocoapods>c__AnonStorey0:<>m__4 (int,Google.IOSResolver/CommandItem[],GooglePlayServices.CommandLine/Result,GooglePlayServices.CommandLineDialog)
    Google.IOSResolver/<RunCommandsAsync>c__AnonStorey2:<>m__5 (GooglePlayServices.CommandLine/Result)
    GooglePlayServices.CommandLineDialog/ProgressReporter:SignalComplete ()
    GooglePlayServices.CommandLineDialog/ProgressReporter:CommandLineToolCompletion (GooglePlayServices.CommandLine/Result)
    GooglePlayServices.CommandLine/<RunAsync>c__AnonStorey0/<RunAsync>c__AnonStorey1:<>m__4 ()
    Google.RunOnMainThread:ExecuteNext ()
    Google.RunOnMainThread:<ExecuteAll>m__A ()
    Google.RunOnMainThread:RunAction (System.Action)
    Google.RunOnMainThread:ExecuteAll ()
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:356)

    I found an old thread that discusses a similar issue with Unity 2019 - the suggestion there was manual pod installs after the build and ignoring the warning within unity - would prefer something cleaner :)

    Any thoughts or pointers would be greatly appreciated!
     
    Last edited: Apr 11, 2023
  2. AndrewAtCandlelight

    AndrewAtCandlelight

    Joined:
    May 3, 2022
    Posts:
    7
    FWIW if anyone has a similar issue, upgrading from MacOS12 to MacOS13 seems to have fixed the ruby/cocoapods conflicts I was experiencing.

    If you are having similar problems and upgrading isn't possible / relevant, there are several other threads on these forums with other solutions as well - I needed to browse through "similar results" on a google query to find them since I couldn't find the best way to do it from within the forums themselves.

    https://forum.unity.com/threads/unity-build-error-error-running-cocoapods.457549/

    https://forum.unity.com/threads/error-installing-cocoapods.1028422/

    https://forum.unity.com/threads/failed-to-install-cocoapods.489700/

    also possibly useful:

    https://gist.github.com/lecksfrawen/805144a37c09d3cfe258783c9a9d7528

    https://guides.cocoapods.org/using/troubleshooting#installing-cocoapods

     
    ebitaigames and Petr777 like this.
  3. unity_b18f078Kf4ZjjQ

    unity_b18f078Kf4ZjjQ

    Joined:
    Jan 1, 2019
    Posts:
    1
    I had a similar problema with the same waring:

    WARNING: You don't have /Users/username/.gem/ruby/2.6.0/bin in your PATH,
    gem executables will not run.

    and Dependency manager failing in initializing or detecting pods on Mac OSX.

    After a bit of investigation I found out that Unity Jar Resolver for OSX uses bash while the default terminal on osx is zsh. That means that installing, via brew or any other tool, ruby, renv, gem etc will make them visible only on zsh.
    https://github.com/googlesamples/un...ource/AndroidResolver/src/CommandLine.cs#L602

    to solve the issue I create .bash_profile and .bashrc to load the same zsh configuration in bash.

    bash_profile (if not present, append otherwise):

    # Set PATH, MANPATH, etc., for Homebrew.
    eval "$(/opt/homebrew/bin/brew shellenv)"

    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi


    and bashrc

    eval "$(rbenv init - bash)"


    that fixed my problem, I hope it can help any other having the same issue
     
  4. msp_

    msp_

    Joined:
    Jul 26, 2019
    Posts:
    4
    Smart sleuthing! It helped me out, thanks