Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native: should I install Cocoapods with gem or homebrew?

The React Native docs recommend installing Cocoapods with sudo gem install cocoapods, but I'm used to using Homebrew and have seen elsewhere that people install it with brew install cocoapods. When I try installing it with Homebrew, I get this warning:

Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods

What I Want To Know:

  1. What's the difference, if any, between installing Cocoapods with sudo gem install cocoapods and with brew install cocoapods

  2. If I install it with Homebrew, should I install the regular package or the cask? What's the difference?

like image 397
gkeenley Avatar asked Jan 04 '21 22:01

gkeenley


People also ask

What is CocoaPods gem?

0. CocoaPods manages library dependencies for your Xcode project. You specify the dependencies for your project in one easy text file. CocoaPods resolves dependencies between libraries, fetches source code for the dependencies, and creates and maintains an Xcode workspace to build your project.


1 Answers

macOS comes with a pre-installed version of Ruby. If you try to install a gem through pre-installed Ruby, you've to use sudo by default witch is not a good practice.

Another option is to install CocoaPods in your user-level directory by following instructions available on the Sudo-less installation section.

I would suggest you install CocoaPods using brew. It's a little cleaner option and you can update it easier.

The cocoapods cask is for CocoaPads App and the formula is for the CLI only version.

like image 99
nekofar Avatar answered Oct 14 '22 00:10

nekofar