Error installing cocoapods: drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210
Asked Answered
A

6

42

I want to develop a project with react native Cli. I read the react native documentation. I should install cocoapods.

But when I write sudo gem install cocoapods, the terminal returns

Error installing cocoapods:
    The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.5. Try installing it with `gem install drb -v 2.0.5` and then running the current command again
    drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

I couldn't update ruby. When I write rvm install 2.7.6 a different error is returned. What should I do?

Artois answered 22/10, 2023 at 10:30 Comment(0)
R
72

if you are using macOS, How about using homebrew than gem?
I had exactly same problem, so I tried to install it using homebrew

brew install cocoapods

My problem was clearly resolved!

Revisal answered 29/10, 2023 at 2:44 Comment(5)
My problem was clearly resolved too. Thanks for the solutionSpiegelman
The solution is working perfectly in my M2 Pro. Thank you so much.Pacifica
How exactly does this solve the problem? Does it install a different version than the ruby gems installation tool, by default?Disrobe
"Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!" on my M1 ProCummerbund
command not found: brew Getting this error on installing with brewPiled
P
25

If you encounter an error stating that CocoaPods downloader requires Ruby version >= 2.7.4, you can update your Ruby version using a Ruby version manager like rbenv. Follow these steps:

  1. Install rbenv: If you don’t have rbenv installed, you can install it using a package manager like Homebrew. Open Terminal and run:
brew install rbenv
  1. Add the following lines to your shell profile file (.bash_profile, .zshrc, etc.). You can get this files from Macintosh HD/ Users/username and search for hidden files command + shift + . edit:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
  1. Restart your Terminal .
  2. Install Ruby 2.7.4. Run the following command:
rbenv install 2.7.4
  1. This will download and install Ruby 2.7.4. Restart your terminal.
  2. Set Ruby 2.7.4 as the global version for your system:
rbenv global 2.7.4
  1. Verify Ruby version: Ensure that Ruby 2.7.4 is now the active version:
ruby -v
  1. Try installing CocoaPods again
sudo gem install cocoapods

This should resolve the issue, and you should be able to use CocoaPods without any problems.

Phonics answered 30/10, 2023 at 7:5 Comment(3)
Formatting of export breaks it. Needs to be: export PATH="$HOME/.rbenv/bin:$PATH"<br/> eval "$(rbenv init -)"Palstave
I missed to mention the new-line <br/> in second step. Thanks @TasosZervos for rectifying errors.Phonics
This is the right way to resolve the mentioned issue. Other's may also work but this one is the recommended way. ThanksAuklet
D
8

If you read the error message carefully, you may find a solution within the error message.

sudo gem install drb -v 2.0.5

You can try this line in terminal.

Damselfish answered 24/10, 2023 at 10:28 Comment(0)
A
4
  1. sudo gem install cocoapods
  2. got error with drb requires Ruby version >= 2.7.0
  3. You need install ruby
  4. sudo gem install drb -v 2.0.6
  5. Again install sudo gem install cocoapods
  6. sudo gem install activesupport -v 6.1.7.7
  7. Again install sudo gem install cocoapods
  8. check with your pod --version
    Your problem solved.
Aletaaletha answered 29/3 at 17:44 Comment(0)
W
1

First way:

brew install cocoapods

Second way:

brew update
brew install ruby

# If you use bash
echo 'export PATH=/usr/local/Cellar/ruby/2.4.1_1/bin:$PATH' >> ~/.bash_profile 

# If you use ZSH:
echo 'export PATH=/usr/local/Cellar/ruby/2.4.1_1/bin:$PATH' >> ~/.zprofile

sudo gem install cocoapods
Weakness answered 15/1 at 10:7 Comment(0)
T
1

I didn't have to use sudo to install it. Just run:

brew install cocoapods

After succesful installation, run:

brew link cocoapods

This should work.

However, if you get an error like this: "Error: Could not symlink bin/xcodeproj, Target /usr/local/bin/xcodeproj already exists", you can overwrite it using:

brew link --overwrite cocoapods

Hope this helps. Good luck.

Thiouracil answered 20/2 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.