Failed to install Cocoapods

Hello,
I’m using Unity 5.2.4f and I have installed ruby 1.9.3 on my old Mac with Lion OS X 10.7.5 system on it.
When I open Unity project there is an installation attempt which failing and I don’t know how to solve this, after trying few days. Here is the error I get:

IOS RESOLVER

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):


WARNING:  You don't have /Users/DAN26/.gem/ruby/1.8/bin in your PATH,
     gem executables will not run.
ERROR:  Error installing activesupport:
   i18n requires Ruby version >= 1.9.3.

So I go to the Terminal and do the following:

export PATH="/Users/DAN26/.gem/ruby/1.9.3/bin:$PATH"

No change. So I do this:

export PATH="/Users/DAN26/.gem/ruby/1.8/bin:$PATH"

Still get the same message…

Enter $PATH

-bash: /usr/local/opt/openssl/bin:/Users/DAN26/.rbenv/bin:/Users/DAN26/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/DAN26/.rvm/bin: No such file or directory

Also if I enter in the Terminal:

gem list

I get this:

*** LOCAL GEMS ***

activesupport (4.2.9)
bigdecimal (1.1.0)
fuzzy_match (2.0.4)
i18n (0.8.6)
io-console (0.3)
json (1.5.5)
minitest (5.10.3, 2.5.1)
nap (1.1.0)
rake (0.9.2.2)
rdoc (3.9.5)
thread_safe (0.3.6)
tzinfo (1.2.3)

Please help me to solve this problem
Thanks

EDIT: I have installed activesupport 4.2.5 and cocoapods 0.34.4 but no change.

*** LOCAL GEMS ***

activesupport (4.2.9, 4.2.6, 4.2.5, 3.2.22.5)
bigdecimal (1.1.0)
claide (0.7.0)
cocoapods (0.34.4)
cocoapods-core (0.34.4)
cocoapods-downloader (0.7.2)
cocoapods-plugins (0.3.2)
cocoapods-trunk (0.3.1)
cocoapods-try (0.4.5)
colored (1.2)
escape (0.0.4)
fuzzy_match (2.0.4)
i18n (0.8.6)
io-console (0.3)
json (1.8.6, 1.5.5)
json_pure (1.8.6)
minitest (5.10.3, 2.5.1)
multi_json (1.12.1)
nap (1.1.0, 0.8.0)
netrc (0.7.8)
open4 (1.3.4)
rake (0.9.2.2)
rdoc (3.9.5)
thread_safe (0.3.6)
tzinfo (1.2.3)
xcodeproj (0.19.4)

Well, since I were using Google Drive File Stream directory I found that cocoa pods are uncompatible to this folder system. So I change the build’s folder from Unity’s build settings and that’s it!
Hope you have already found a solution

i am facing the sam error, Any solution ?

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:

'gem install cocoapods ’ failed with code (1):

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 /Users/deepan/.gem/ruby/2.3.0/specifications/fuzzy_match-2.0.4.gemspec:17.
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 /Users/deepan/.gem/ruby/2.3.0/specifications/i18n-0.9.5.gemspec:17.
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.
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 /Users/deepan/.gem/ruby/2.3.0/specifications/i18n-0.9.5.gemspec:17.
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 /Users/deepan/.gem/ruby/2.3.0/specifications/fuzzy_match-2.0.4.gemspec:17.
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/

I manually ran
‘gem install cocoapods’

in my unity project folder, and it stopped happening

6 Likes

I had the issue on a new install of mac os / unity / xcode. What solved it for me was to just run XCode manually once, and it installed everything that it needed.

2 Likes

In order to get the cocoapods to run/install properly, I also needed to allow my user to make changes to /Library/Ruby/ on macOS. If you run into this same issue on macOS, do not try using chmod to change permissions on /Library/Ruby/. There is a better way on macOS.

To give yourself change permissions on /Library/Ruby/:

  • Open the Terminal application. (Press Command-Space, then type Terminal, and hit return.)
  • In Terminal, at the prompt, type cd /Library and press return. This moves you into the /Library folder in Terminal.
  • In Terminal, type open . (which is the word open followed by a space and a period) and press return. This will open the /Library folder in your Finder. It’s usually hidden from you, which is why we needed to go into Terminal.
  • In Library, you will find a folder named Ruby.
  • Right click on the Ruby folder and select Get Info. (Or Left click the Ruby folder to select it and press Command-i.)
  • Click the lock at the bottom of the Get Info window to unlock it. You will need to type in your login password for the computer and will need to have admin privileges.
  • Click the + at the bottom left of the Get Info window and add your user with Read & Write permissions.
  • That’s it!
8 Likes

Ridiculous as it was I lost a lot of time on this. This fixed it in my case just set the CLT in Xcode and run again.

  • Select Command Line Tools in XCode.
    XCode > Preferences > Locations > Command Line Tools > XCode 11.X.X

Taken from here cocoapods - This terminal won't let me run or install cocoa pods because I am on MacOS Catalina Beta? - Stack Overflow

11 Likes

hey, I used this blog to fix my issue and it was only 2 lines of code

6 Likes

This has worked for me!

Thank you so much for your support. It works :slight_smile:

Hey - i have the same Problem but nothing seems to work.
I have unpacked the Facebook Analytics package into a test Unity project and everything was working fine. Then i have done the same on my working project and i get this errors. The Dummy project opens and runs and my working project fails.

iOS Resolver:
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.

1 Like

@Smileys Any solution?

this works for me on MacOS Big Sur, it looks like that Unity scripts could not find the ruby path correctly.

This one worked for me on Big Sur.
sudo gem install cocoapods -n /usr/local/bin
It was looking in the old place, and when i checked my pods version, it was the old version I hadn’t installed manually. So doing this made it install where Unity is looking for it.

1 Like

I solved this issue by installing cocoapods manually(sudo gem install cocoapods -n /usr/local/bin)
AND UNCHECK the following 2 options that you can find through Asset->External Dependency Manager->iOS Resolver->Settings
Use Shell to Execute Cocoapods Tool
Auto Install Cocoapods Tools in Editor

Seems Unity still try to install cocoapods even if you have already installed cocoapods, and there are also something wrong when calling cocoapods via Shell.

Hope this may help someone.

1 Like

Solved by executing XCODE first time.

2 Likes

I have a similar problem. The main problem was the right PATH to Ruby and cocoapods, because Unity uses bash shell but on my mac terminal was zshrc shell. These two shells don’t share paths configuration files and you need to set the Unity-bash shell configuration file to work properly with the right Path.

3 Likes

This worked for me:

Depending on some aspects this might work for you, if you don’t mind using the “SUDO” command:

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

Latest CocoaPods 1.10.0 won’t work.

Thanks to Fluttering (Fluttering’s Profile | Apple Developer Forums)

3 Likes

thank you so much

adding these lines in .bash_profile solved it for me

export PATH=/usr/bin:$PATH
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH