222

Trying to install CocoaPods from the terminal:

$ sudo gem install cocoapods

After entering my root password, nothing happens.

How can I debug that?

3
  • 2
    Sounds like you should check out RVM or rbenv for managing Ruby stuff. The Ruby support that ships with OS X seems quite slow with stuff like that. Commented Jan 17, 2013 at 14:04
  • That was indeed very slow, but finally worked. Commented Jan 17, 2013 at 20:00
  • @KeithSmiley These days, this would be bad advice. I went down that route in the past, but it caused more trouble tbh. CocoaPods officially states on their website "CocoaPods is built with Ruby and is installable with the default Ruby available on macOS. We recommend you use the default ruby.", so best to stick with that. rvm is great if you are a Ruby developer, but their .rvmrc approach is not straight-forward, there are no pre-built ruby binaries and updating CocoaPods often leads to a version puzzle with ruby. CocoaPods is only for macOS, it doesn't need to be portable whatsoever. Commented May 28 at 18:49

9 Answers 9

473

For others wondering the same, installing the gem takes forever. If you run:

export GEM_HOME=~/.gems
export PATH=$GEM_HOME/bin:$PATH

gem install cocoapods -V

Installing with flag V enables verbose output which will let you see all the output as it is going through the download and install, it's quite a lot.

Sign up to request clarification or add additional context in comments.

7 Comments

Also, updating the package manager seems to speed things up alot. sudo gem update --system
Just a note for -V (it is in uppercase) :D
instead of -V you can use --verbose
This verbose option should be on by default... I aborted the install three times before I found this post :~
Great answer. I would have never figured out it was working otherwise. Just curious. Anyone know why its so full of 302 redirects?
|
57

update gem to the newest release using

sudo gem update --system and it should work a bit faster

Comments

34

I had to wait at least 5 minutes before:

Building native extensions. This could take a while...

Appears

Comments

13

It's not stuck, it's downloading file for ruby from the internet. you can check this by following below steps:

  1. Open Activity Monitor

  2. Select Network option

  3. Check below Google Chrome. (ruby downloading)

enter image description here

1 Comment

It is true that ruby is downloading cocoapods slowly.
13

MacOS Sonoma 14.0, installing cocoapods for flutter doctor check.

I have cocoapods installed by this way:

Step 1 (install HomeBrew)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)

Step 2 (Run these two commands in your terminal to add Homebrew to your PATH)

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/”YOUR USER FORLDER”/.zprofile  
eval "$(/opt/homebrew/bin/brew shellenv)"

Step 3 (now you can install cocoapods)

brew install cocoapods

2 Comments

Just do this instead of using gem. Way better and cleaner.
Please add " at the end of the command in Step 1.
4

You should do it in two separated commands:

First:

gem update

Then:

export GEM_HOME=~/.gems
export PATH=$GEM_HOME/bin:$PATH

gem install cocoapods

Comments

4

Yes it takes forever keep calm and wait for at least 5 minutes , then you will see something, I did that in Ventura 13, I had to wait for 10 minutes. Hope this is helps, its like "light at the end of the tunnel".

Comments

1

I received an error: "Error installing cocoapods: The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.3. Try installing it with gem install activesupport -v 6.1.7.3 and then running the current command again activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210."

So, I had to run 'sudo gem install activesupport -v 6.1.7.3', for Ventura 13

Comments

-1

Try Installing latest Git version from

https://git-scm.com/downloads

This worked for me

Write the following commands in Terminal:

  1. export GEM_HOME=~/.gems
  2. export PATH=$GEM_HOME/bin:$PATH
  3. gem install cocoapods
  4. Set the path of the project with the command cd path/to/project
  5. pod init
  6. Open podfile
  7. Add appropriate pod
  8. pod install

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.