Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(ios): install cocoapods with homebrew #1399

Merged

Conversation

GitToTheHub
Copy link
Contributor

@GitToTheHub GitToTheHub commented Feb 12, 2025

Platforms affected

macOS

Motivation and Context

I tried to setup my machine and got an error when installing cocoa pods

Description

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

- cocoapods are not installable with the current system ruby version on macOS. When trying to install with sudo gem install cocoapods, the error message will appear: securerandom requires Ruby version >= 3.1.0. The current ruby version is 2.6.10.210.
- On stackoverflow it is suggested to install it instead with homebrew: https://stackoverflow.com/questions/77339560/error-installing-cocoapodsdrb-requires-ruby-version-2-7-0-the-current-ruby
@erisu
Copy link
Member

erisu commented Feb 13, 2025

Do we know if CocoaPods manages the Homebrew package, or is it handled by a third party?

The current guide follows the steps provided on the official CocoaPods website.

In fact, CocoaPods does not recommend using the default macOS system Ruby. Instead, it suggests using a Ruby version manager to install a newer version. For example, the rvm package, which can be installed via Homebrew.

In my case, I have a newer version of Ruby installed on macOS:

% ruby -v
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]

Here is their official installation guide, which recommends using a Ruby version manager:
https://guides.cocoapods.org/using/getting-started.html#installation

@erisu erisu changed the title iOS Guide: Install cocoapods with homebrew doc(ios): install cocoapods with homebrew Feb 13, 2025
@GitToTheHub
Copy link
Contributor Author

GitToTheHub commented Feb 13, 2025

The homebrew package is maintained by homebrew itself: https://github.com/Homebrew/homebrew-core/blob/447e92edf265af365ed4fd3feb5abcb2d204a956/Formula/c/cocoapods.rb

If we use the Cocoapods recommendation I would change the documentation to first load a recent ruby version by brew install ruby and then installing Cocoapods by gem install cocoapods.

Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be OK to update the guide to use brew install cocoapods.

It seems,

I'm not 100% sure, but if a user had installed Ruby via brew, would Homebrew use that version instead of the portable version?

At the very least, it seems to ignore the older system's default Ruby, as your PR description suggests its resolved the securerandom requires Ruby version >= 3.1.0. The current ruby version is 2.6.10.210 issue.

I'll wait a bit to see if anyone else has questions or comments. But other than that, I think it's OK to merge.

@GitToTheHub
Copy link
Contributor Author

Cool, thanks for the explanation. I learned a little bit :)

Copy link
Member

@NiklasMerz NiklasMerz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that. Most Mac users should have brew and using it is much more reliable.

@erisu erisu merged commit 54bfcc3 into apache:master Feb 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants